diff --git a/meshroom/ui/qml/Viewer/PanoramaImageToolbar.qml b/meshroom/ui/qml/Viewer/PanoramaImageToolbar.qml index ce491184..06bcc4d5 100644 --- a/meshroom/ui/qml/Viewer/PanoramaImageToolbar.qml +++ b/meshroom/ui/qml/Viewer/PanoramaImageToolbar.qml @@ -10,9 +10,11 @@ FloatingPane { padding: 5 radius: 0 + property int opacityDefaultValue: 100 property real gainDefaultValue: 1 property real gammaDefaultValue: 1 property real slidersPowerValue: 4 + property int opacityValue: Math.pow(opacityCtrl.value, 1) property real gainValue: Math.pow(gainCtrl.value, slidersPowerValue) property real gammaValue: Math.pow(gammaCtrl.value, slidersPowerValue) property string channelModeValue: channelsCtrl.value @@ -56,6 +58,46 @@ FloatingPane { checked: false } + // Grid opacity slider + RowLayout { + spacing: 5 + + ToolButton { + text: "Grid Opacity" + + ToolTip.visible: ToolTip.text && hovered + ToolTip.delay: 100 + ToolTip.text: "Reset Opacity" + + onClicked: { + opacityCtrl.value = opacityDefaultValue; + } + } + TextField { + id: opacityLabel + + ToolTip.visible: ToolTip.text && hovered + ToolTip.delay: 100 + ToolTip.text: "Grid opacity" + + text: opacityValue.toFixed(1) + Layout.preferredWidth: textMetrics_opacityValue.width + selectByMouse: true + validator: doubleValidator + onAccepted: { + opacityCtrl.value = Number(opacityLabel.text) + } + } + Slider { + id: opacityCtrl + Layout.fillWidth: true + from: 0 + to: 100 + value: opacityDefaultValue + stepSize: 1 + } + } + // gain slider RowLayout { spacing: 5 @@ -142,4 +184,9 @@ FloatingPane { font: gainLabel.font text: "1.2345" } + TextMetrics { + id: textMetrics_opacityValue + font: opacityLabel.font + text: "100.000" + } } diff --git a/meshroom/ui/qml/Viewer/PanoramaViewer.qml b/meshroom/ui/qml/Viewer/PanoramaViewer.qml index eb6f0cc1..90970233 100644 --- a/meshroom/ui/qml/Viewer/PanoramaViewer.qml +++ b/meshroom/ui/qml/Viewer/PanoramaViewer.qml @@ -33,10 +33,16 @@ AliceVision.PanoramaViewer { property bool isGridDisplayed : false; property string channelModeString : "rgba" + property int gridOpacity : 100; + onIsGridDisplayedChanged: { root.displayGrid() } + onGridOpacityChanged: { + root.setGridColorQML(Qt.rgba(255, 0, 0, gridOpacity/100)); + } + channelMode: { switch(channelModeString) { @@ -101,8 +107,8 @@ AliceVision.PanoramaViewer { id: rectGrid Rectangle { id: rect - width: 20; height: width - radius: 10 + width: root.sourceSize.width/100; height: width + radius: width/2 x: root.getVertex(model.index).x - (width / 2) y: root.getVertex(model.index).y - (height / 2) color: "yellow" @@ -116,7 +122,7 @@ AliceVision.PanoramaViewer { drag.smoothed: false drag.axis: Drag.XAndYAxis onReleased: { - root.setVertex(index, rect.x + (20 / 2), rect.y + (20 / 2)) + root.setVertex(index, rect.x + (width / 2), rect.y + (height / 2)) } } } diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index 4ed6f5a0..0b14b20b 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -255,7 +255,8 @@ FocusScope { 'gamma': Qt.binding(function() { return panoramaImageToolbar.gammaValue; }), 'gain': Qt.binding(function() { return panoramaImageToolbar.gainValue; }), 'channelModeString': Qt.binding(function() { return panoramaImageToolbar.channelModeValue; }), - 'isGridDisplayed' : Qt.binding(function(){ return panoramaImageToolbar.displayGrid;}) + 'isGridDisplayed' : Qt.binding(function(){ return panoramaImageToolbar.displayGrid;}), + 'gridOpacity' : Qt.binding(function(){ return panoramaImageToolbar.opacityValue;}) }) } else { // Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14