[Lens Distortion] Update UI

This commit is contained in:
Landrodie 2021-01-14 11:11:14 +01:00 committed by Fabien Castan
parent c9f0ab0d16
commit 29b7e808a1
2 changed files with 40 additions and 134 deletions

View file

@ -214,7 +214,7 @@ FocusScope {
// qtAliceVision Image Viewer
Loader {
id: floatImageViewerLoader
active: root.aliceVisionPluginAvailable && root.useFloatImageViewer && !lensDistortionViewerLoader.active
active: root.aliceVisionPluginAvailable && (root.useFloatImageViewer || root.useLensDistortionViewer)
visible: (floatImageViewerLoader.status === Loader.Ready)
anchors.centerIn: parent
@ -228,32 +228,6 @@ FocusScope {
'gamma': Qt.binding(function() { return hdrImageToolbar.gammaValue; }),
'gain': Qt.binding(function() { return hdrImageToolbar.gainValue; }),
'channelModeString': Qt.binding(function() { return hdrImageToolbar.channelModeValue; }),
})
} else {
// Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
setSource("", {})
}
}
}
// qtAliceVision Panorama Viewer
Loader {
id: lensDistortionViewerLoader
active: root.aliceVisionPluginAvailable && root.useLensDistortionViewer && !floatImageViewerLoader.active
visible: (lensDistortionViewerLoader.status === Loader.Ready)
anchors.centerIn: parent
onActiveChanged: {
if(active) {
// instantiate and initialize a FeaturesViewer component dynamically using Loader.setSource
// Note: It does not work to use previously created component, so we re-create it with setSource.
// floatViewerComp.createObject(floatImageViewerLoader, {
setSource("LensDistortionViewer.qml", {
'source': Qt.binding(function() { return getImageFile(imageType.type); }),
'gamma': Qt.binding(function() { return lensDistortionImageToolbar.gammaValue; }),
'gain': Qt.binding(function() { return lensDistortionImageToolbar.gainValue; }),
'channelModeString': Qt.binding(function() { return lensDistortionImageToolbar.channelModeValue; }),
'isCtrlPointsDisplayed' : Qt.binding(function(){ return lensDistortionImageToolbar.displayPoints;}),
'isGridDisplayed' : Qt.binding(function(){ return lensDistortionImageToolbar.displayGrid;}),
'gridOpacity' : Qt.binding(function(){ return lensDistortionImageToolbar.opacityValue;}),
@ -264,12 +238,42 @@ FocusScope {
setSource("", {})
}
}
}
// qtAliceVision Panorama Viewer
// Loader {
// id: lensDistortionViewerLoader
// active: root.aliceVisionPluginAvailable && root.useLensDistortionViewer && !floatImageViewerLoader.active
// visible: (lensDistortionViewerLoader.status === Loader.Ready)
// anchors.centerIn: parent
// onActiveChanged: {
// if(active) {
// // instantiate and initialize a FeaturesViewer component dynamically using Loader.setSource
// // Note: It does not work to use previously created component, so we re-create it with setSource.
// // floatViewerComp.createObject(floatImageViewerLoader, {
// setSource("LensDistortionViewer.qml", {
// 'source': Qt.binding(function() { return getImageFile(imageType.type); }),
// 'gamma': Qt.binding(function() { return lensDistortionImageToolbar.gammaValue; }),
// 'gain': Qt.binding(function() { return lensDistortionImageToolbar.gainValue; }),
// 'channelModeString': Qt.binding(function() { return lensDistortionImageToolbar.channelModeValue; }),
// 'isCtrlPointsDisplayed' : Qt.binding(function(){ return lensDistortionImageToolbar.displayPoints;}),
// 'isGridDisplayed' : Qt.binding(function(){ return lensDistortionImageToolbar.displayGrid;}),
// 'gridOpacity' : Qt.binding(function(){ return lensDistortionImageToolbar.opacityValue;}),
// 'gridColor' : Qt.binding(function(){ return lensDistortionImageToolbar.color;}),
// })
// } else {
// // Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
// setSource("", {})
// }
// }
// }
// Simple QML Image Viewer (using Qt or qtOIIO to load images)
Loader {
id: qtImageViewerLoader
active: !floatImageViewerLoader.active && !lensDistortionViewerLoader.active
active: !floatImageViewerLoader.active
anchors.centerIn: parent
sourceComponent: Image {
id: qtImageViewer
@ -305,8 +309,6 @@ FocusScope {
//qtImageViewerLoader.active ? qtImageViewerLoader.item : floatImageViewerLoader.item
if (floatImageViewerLoader.active)
floatImageViewerLoader.item
else if (lensDistortionViewerLoader.active)
lensDistortionViewerLoader.item
else
qtImageViewerLoader.item
}