[Panorama Viewer] add subdivisions slider

This commit is contained in:
Landrodie 2021-01-26 11:35:31 +01:00 committed by Fabien Castan
parent b1bac3db3e
commit 3d4579b13d
3 changed files with 59 additions and 4 deletions

View file

@ -17,6 +17,9 @@ FloatingPane {
property int downscaleValue: downscaleSpinBox.value property int downscaleValue: downscaleSpinBox.value
property int downscaleDefaultValue: 2 property int downscaleDefaultValue: 2
property int subdivisionsDefaultValue: 12
property int subdivisionsValue: subdivisionsCtrl.value
background: Rectangle { color: root.palette.window } background: Rectangle { color: root.palette.window }
DoubleValidator { DoubleValidator {
@ -58,6 +61,44 @@ FloatingPane {
checkable: true checkable: true
checked: true checked: true
} }
RowLayout {
spacing: 5
ToolButton {
text: "Subdivisions"
ToolTip.visible: ToolTip.text && hovered
ToolTip.delay: 100
ToolTip.text: "Reset Subdivisions"
onClicked: {
subdivisionsCtrl.value = subdivisionsDefaultValue;
}
}
TextField {
id: subdivisionsLabel
ToolTip.visible: ToolTip.text && hovered
ToolTip.delay: 100
ToolTip.text: "subdivisions"
text: subdivisionsValue.toFixed(1)
Layout.preferredWidth: textMetrics_subdivisionsValue.width
selectByMouse: true
validator: doubleValidator
onAccepted: {
subdivisionsCtrl.value = Number(subdivisionsLabel.text)
}
}
Slider {
id: subdivisionsCtrl
Layout.fillWidth: false
from: 2
to: 24
value: subdivisionsDefaultValue
stepSize: 2
}
}
//Fill rectangle to have a better UI //Fill rectangle to have a better UI
Rectangle { Rectangle {
color: root.palette.window color: root.palette.window
@ -102,5 +143,10 @@ FloatingPane {
} }
} }
TextMetrics {
id: textMetrics_subdivisionsValue
font: subdivisionsLabel.font
text: "10.00"
}
} }

View file

@ -32,12 +32,20 @@ AliceVision.PanoramaViewer {
property int downscaleValue: 2 property int downscaleValue: 2
property int subdivisionsPano: 12
property bool isEditable: true property bool isEditable: true
property bool isHighlightable: true property bool isHighlightable: true
onIsHighlightableChanged:{ onIsHighlightableChanged:{
for (var i = 0; i < repeater.model; i++) { for (var i = 0; i < repeater.model; i++) {
var highlight = repeater.itemAt(i).item.onChangedHighlightState(isHighlightable); repeater.itemAt(i).item.onChangedHighlightState(isHighlightable);
}
}
onSubdivisionsPanoChanged:{
for (var i = 0; i < repeater.model; i++) {
repeater.itemAt(i).item.subdivisions=subdivisionsPano;
} }
} }

View file

@ -258,9 +258,10 @@ FocusScope {
if(active) { if(active) {
setSource("PanoramaViewer.qml", { setSource("PanoramaViewer.qml", {
'source': Qt.binding(function() { return getImageFile(imageType.type); }), 'source': Qt.binding(function() { return getImageFile(imageType.type); }),
'isEditable': Qt.binding(function(){ return panoramaViewerToolbar.enableEdit}), 'isEditable': Qt.binding(function(){ return panoramaViewerToolbar.enableEdit;}),
'isHighlightable': Qt.binding(function(){ return panoramaViewerToolbar.enableHover}), 'isHighlightable': Qt.binding(function(){ return panoramaViewerToolbar.enableHover;}),
'downscaleValue': Qt.binding(function(){return panoramaViewerToolbar.downscaleValue;}) 'downscaleValue': Qt.binding(function(){return panoramaViewerToolbar.downscaleValue;}),
'subdivisionsPano': Qt.binding(function(){ return panoramaViewerToolbar.subdivisionsValue;})
}) })
} else { } else {
// Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14 // Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14