Consistent right-click and press and hold for editing

Instrument panel and hud now use consistent editing enable mechanism
This commit is contained in:
Don Gagne
2025-02-16 11:56:40 -08:00
committed by Don Gagne
parent 1e2ec3666b
commit 9e8ef45c1c
2 changed files with 16 additions and 21 deletions
+10 -11
View File
@@ -32,8 +32,6 @@ Item {
opacity: 0.75
}
//DeadMouseArea { anchors.fill: parent }
ColumnLayout {
id: mainLayout
anchors.margins: _toolsMargin
@@ -41,10 +39,10 @@ Item {
anchors.left: parent.left
RowLayout {
visible: mouseArea.containsMouse || valueArea.settingsUnlocked
visible: valueArea.settingsUnlocked
QGCColoredImage {
source: valueArea.settingsUnlocked ? "/res/LockOpen.svg" : "/res/pencil.svg"
source: "qrc:/InstrumentValueIcons/lock-open.svg"
mipmap: true
width: ScreenTools.minTouchPixels * 0.75
height: width
@@ -54,9 +52,7 @@ Item {
QGCMouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: valueArea.settingsUnlocked = !valueArea.settingsUnlocked
onClicked: valueArea.settingsUnlocked = false
}
}
}
@@ -74,17 +70,20 @@ Item {
y: mainLayout.y
width: mainLayout.width
height: mainLayout.height
hoverEnabled: !ScreenTools.isMobile
acceptedButtons: Qt.LeftButton | Qt.RightButton
propagateComposedEvents: true
visible: !valueArea.settingsUnlocked
onClicked: (mouse) => {
if (ScreenTools.isMobile) {
if (!ScreenTools.isMobile && mouse.button === Qt.RightButton) {
valueArea.settingsUnlocked = true
mouse.accepted = true
} else {
mouse.accepted = false
}
}
onPressAndHold: {
valueArea.settingsUnlocked = true
mouse.accepted = true
}
}
}
+6 -10
View File
@@ -42,16 +42,16 @@ Control {
spacing: ScreenTools.defaultFontPixelWidth
visible: _showSelectionUI
QGCButton {
onClicked: _showSelectionUI = false
iconSource: "qrc:/InstrumentValueIcons/lock-open.svg"
}
FactComboBox {
fact: selectedControl
indexModel: false
sizeToContents: true
}
QGCButton {
text: qsTr("X")
onClicked: _showSelectionUI = false
}
}
}
@@ -74,11 +74,7 @@ Control {
}
}
onPressAndHold: {
if (ScreenTools.isMobile) {
_showSelectionUI = true
}
}
onPressAndHold: _showSelectionUI = true
}
}
}