mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-04 01:08:26 +02:00
[ui] Only update active CameraInit
and its index when they are changed
Prior to this commit, when a `CameraInit` node was added to or removed from the list of `CameraInit` nodes, the active `CameraInit` was always reset to the first one in the list, independently from its previous value. This commit changes that behaviour by only modifying the active `CameraInit` if no `CameraInit` node has been assigned yet, or if the active `CameraInit` does not exist anymore (meaning it has been removed). This requires to emit the `cameraInitChanged` signal every single time the list of existing `CameraInit` nodes is modified even if the active one is not changed, and to connect it to the ImageGallery in order to ensure the index from the combo box always corresponds to the currently active `CameraInit` node. Indeed, when the list of CameraInits is updated, the model for the combo box is reset, and it needs to be re-updated with the correct non-default value.
This commit is contained in:
parent
4c1a294ca2
commit
a606a8f83c
2 changed files with 14 additions and 1 deletions
|
@ -35,6 +35,14 @@ Panel {
|
|||
title: "Image Gallery"
|
||||
implicitWidth: (root.defaultCellSize + 2) * 2
|
||||
|
||||
Connections {
|
||||
target: _reconstruction
|
||||
|
||||
function onCameraInitChanged() {
|
||||
nodesCB.currentIndex = root.cameraInitIndex
|
||||
}
|
||||
}
|
||||
|
||||
QtObject {
|
||||
id: m
|
||||
property variant currentCameraInit: _reconstruction && _reconstruction.tempCameraInit ? _reconstruction.tempCameraInit : root.cameraInit
|
||||
|
|
|
@ -573,7 +573,12 @@ class Reconstruction(UIGraph):
|
|||
if set(self._cameraInits.objectList()) == set(cameraInits):
|
||||
return
|
||||
self._cameraInits.setObjectList(cameraInits)
|
||||
self.cameraInit = cameraInits[0] if cameraInits else None
|
||||
|
||||
if self.cameraInit is None or self.cameraInit not in cameraInits:
|
||||
self.cameraInit = cameraInits[0] if cameraInits else None
|
||||
|
||||
# Manually emit the signal to ensure the active CameraInit index is always up-to-date in the UI
|
||||
self.cameraInitChanged.emit()
|
||||
|
||||
def getCameraInitIndex(self):
|
||||
if not self._cameraInit:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue