Commit 1d0a02d2 authored by Gus Grubba's avatar Gus Grubba

Convert old style overlay dialogs in Offline Maps to QtQuick 2.4 controls (Popup)

parent c0aec101
...@@ -680,7 +680,6 @@ Item { ...@@ -680,7 +680,6 @@ Item {
/// Close all dialogs /// Close all dialogs
function closeAll() { function closeAll() {
rootLoader.sourceComponent = null
guidedActionConfirm.visible = false guidedActionConfirm.visible = false
guidedActionList.visible = false guidedActionList.visible = false
altitudeSlider.visible = false altitudeSlider.visible = false
......
...@@ -8,23 +8,26 @@ ...@@ -8,23 +8,26 @@
****************************************************************************/ ****************************************************************************/
import QtQuick 2.3 import QtQuick 2.3
import QtQuick.Controls 1.2 import QtQuick.Controls 2.4
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
Rectangle { Button {
id: mapButton id: mapButton
anchors.margins: ScreenTools.defaultFontPixelWidth height: ScreenTools.defaultFontPixelHeight * 4
color: _showHighlight ? qgcPal.buttonHighlight : qgcPal.button autoExclusive: true
border.width: _showBorder ? 1: 0
border.color: qgcPal.buttonText background: Rectangle {
anchors.fill: parent
color: _showHighlight ? qgcPal.buttonHighlight : qgcPal.button
border.width: _showBorder ? 1: 0
border.color: qgcPal.buttonText
}
property var tileSet: null property var tileSet: null
property var currentSet: null property var currentSet: null
property bool checked: false
property bool complete: false property bool complete: false
property alias text: nameLabel.text
property int tiles: 0 property int tiles: 0
property string size: "" property string size: ""
...@@ -37,27 +40,11 @@ Rectangle { ...@@ -37,27 +40,11 @@ Rectangle {
property bool _pressed: false property bool _pressed: false
property bool _hovered: false property bool _hovered: false
signal clicked() contentItem: Row {
anchors.centerIn: parent
property ExclusiveGroup exclusiveGroup: null anchors.margins: ScreenTools.defaultFontPixelWidth
onExclusiveGroupChanged: {
if (exclusiveGroup) {
checked = false
exclusiveGroup.bindCheckable(mapButton)
}
}
onCheckedChanged: {
if(checked) {
currentSet = tileSet
}
}
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
Row {
anchors.centerIn: parent
QGCLabel { QGCLabel {
id: nameLabel text: mapButton.text
width: mapButton.width * 0.4 width: mapButton.width * 0.4
color: _showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText color: _showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
...@@ -97,62 +84,4 @@ Rectangle { ...@@ -97,62 +84,4 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
MouseArea {
anchors.fill: parent
hoverEnabled: !ScreenTools.isMobile
onMouseXChanged: {
if(!ScreenTools.isMobile) {
_lastGlobalMouseX = ScreenTools.mouseX()
_lastGlobalMouseY = ScreenTools.mouseY()
}
}
onMouseYChanged: {
if(!ScreenTools.isMobile) {
_lastGlobalMouseX = ScreenTools.mouseX()
_lastGlobalMouseY = ScreenTools.mouseY()
}
}
onEntered: {
if(!ScreenTools.isMobile) {
_hovered = true
_forceHoverOff = false
hoverTimer.start()
}
}
onExited: {
if(!ScreenTools.isMobile) {
_hovered = false
_forceHoverOff = false
hoverTimer.stop()
}
}
onPressed: {
if(!ScreenTools.isMobile) {
_pressed = true
}
}
onReleased: {
if(!ScreenTools.isMobile) {
_pressed = false
}
}
onClicked: {
checked = true
mapButton.clicked()
}
}
Timer {
id: hoverTimer
interval: 250
repeat: !ScreenTools.isMobile
onTriggered: {
if (_lastGlobalMouseX !== ScreenTools.mouseX() || _lastGlobalMouseY !== ScreenTools.mouseY()) {
_forceHoverOff = true
} else {
_forceHoverOff = false
}
}
}
} }
...@@ -22,8 +22,6 @@ Button { ...@@ -22,8 +22,6 @@ Button {
property bool logo: false property bool logo: false
QGCPalette { id: qgcPal }
background: Rectangle { background: Rectangle {
anchors.fill: parent anchors.fill: parent
color: logo ? qgcPal.brandingPurple : (checked ? qgcPal.buttonHighlight : Qt.rgba(0,0,0,0)) color: logo ? qgcPal.brandingPurple : (checked ? qgcPal.buttonHighlight : Qt.rgba(0,0,0,0))
......
...@@ -309,6 +309,7 @@ ApplicationWindow { ...@@ -309,6 +309,7 @@ ApplicationWindow {
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
//-- Loader helper for any child, no matter how deep, to display elements //-- Loader helper for any child, no matter how deep, to display elements
// on top of the main window. // on top of the main window.
// This is DEPRECATED. Use Popup instead.
Loader { Loader {
id: rootLoader id: rootLoader
anchors.centerIn: parent anchors.centerIn: parent
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment