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 {
/// Close all dialogs
function closeAll() {
rootLoader.sourceComponent = null
guidedActionConfirm.visible = false
guidedActionList.visible = false
altitudeSlider.visible = false
......
......@@ -8,23 +8,26 @@
****************************************************************************/
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Controls 2.4
import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
Rectangle {
id: mapButton
anchors.margins: ScreenTools.defaultFontPixelWidth
color: _showHighlight ? qgcPal.buttonHighlight : qgcPal.button
border.width: _showBorder ? 1: 0
border.color: qgcPal.buttonText
Button {
id: mapButton
height: ScreenTools.defaultFontPixelHeight * 4
autoExclusive: true
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 currentSet: null
property bool checked: false
property bool complete: false
property alias text: nameLabel.text
property int tiles: 0
property string size: ""
......@@ -37,27 +40,11 @@ Rectangle {
property bool _pressed: false
property bool _hovered: false
signal clicked()
property ExclusiveGroup exclusiveGroup: null
onExclusiveGroupChanged: {
if (exclusiveGroup) {
checked = false
exclusiveGroup.bindCheckable(mapButton)
}
}
onCheckedChanged: {
if(checked) {
currentSet = tileSet
}
}
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
Row {
anchors.centerIn: parent
contentItem: Row {
anchors.centerIn: parent
anchors.margins: ScreenTools.defaultFontPixelWidth
QGCLabel {
id: nameLabel
text: mapButton.text
width: mapButton.width * 0.4
color: _showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText
anchors.verticalCenter: parent.verticalCenter
......@@ -97,62 +84,4 @@ Rectangle {
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 {
property bool logo: false
QGCPalette { id: qgcPal }
background: Rectangle {
anchors.fill: parent
color: logo ? qgcPal.brandingPurple : (checked ? qgcPal.buttonHighlight : Qt.rgba(0,0,0,0))
......
......@@ -309,6 +309,7 @@ ApplicationWindow {
//-------------------------------------------------------------------------
//-- Loader helper for any child, no matter how deep, to display elements
// on top of the main window.
// This is DEPRECATED. Use Popup instead.
Loader {
id: rootLoader
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