mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mapwidget.qml: add visual tracking of editMode from MapWidgetHelper
The MapWidgetHelper QML instance now has the slot onEditModeChanged() which toggles the visiblity of a newly added message box that notifies the user if editing mode is enabled. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
4a004f37ea
commit
3589e2e952
1 changed files with 33 additions and 0 deletions
|
@ -15,10 +15,12 @@ Item {
|
|||
MapWidgetHelper {
|
||||
id: mapHelper
|
||||
map: map
|
||||
editMode: false
|
||||
onSelectedDivesChanged: {
|
||||
// 'list' contains a list of dive list indexes
|
||||
nSelectedDives = list.length
|
||||
}
|
||||
onEditModeChanged: editMessage.isVisible = editMode === true ? 1 : 0
|
||||
}
|
||||
|
||||
Map {
|
||||
|
@ -163,6 +165,37 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: editMessage
|
||||
radius: padding
|
||||
color: "#b08000"
|
||||
border.color: "white"
|
||||
x: (map.width - width) * 0.5; y: padding
|
||||
width: editMessageText.width + padding * 2.0
|
||||
height: editMessageText.height + padding * 2.0
|
||||
visible: false
|
||||
opacity: 0.0
|
||||
property int isVisible: -1
|
||||
property real padding: 10.0
|
||||
|
||||
onOpacityChanged: visible = opacity != 0.0
|
||||
states: [
|
||||
State { when: editMessage.isVisible === 1; PropertyChanges { target: editMessage; opacity: 1.0 }},
|
||||
State { when: editMessage.isVisible === 0; PropertyChanges { target: editMessage; opacity: 0.0 }}
|
||||
]
|
||||
transitions: Transition {
|
||||
NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad }
|
||||
}
|
||||
Text {
|
||||
id: editMessageText
|
||||
y: editMessage.padding; x: editMessage.padding
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: "white"
|
||||
font.pointSize: 11.0
|
||||
text: qsTr("Drag the selected dive location")
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
id: toggleImage
|
||||
x: 10; y: x
|
||||
|
|
Loading…
Add table
Reference in a new issue