Commit 58572f4d authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #4649 from DonLakeFlyer/DropPanelCancel

Modified DropPanel cancel MouseArea creation
parents 5c0dfa95 02980062
...@@ -47,6 +47,7 @@ Item { ...@@ -47,6 +47,7 @@ Item {
property alias _dropDownComponent: dropDownLoader.sourceComponent property alias _dropDownComponent: dropDownLoader.sourceComponent
property real _viewportMaxTop: 0 property real _viewportMaxTop: 0
property real _viewportMaxBottom: parent.parent.height - parent.y property real _viewportMaxBottom: parent.parent.height - parent.y
property var _dropPanelCancel
function show(panelEdgeTopPoint, panelEdgeHeight, panelComponent) { function show(panelEdgeTopPoint, panelEdgeHeight, panelComponent) {
_dropEdgeTopPoint = panelEdgeTopPoint _dropEdgeTopPoint = panelEdgeTopPoint
...@@ -54,9 +55,13 @@ Item { ...@@ -54,9 +55,13 @@ Item {
_dropDownComponent = panelComponent _dropDownComponent = panelComponent
_calcPositions() _calcPositions()
visible = true visible = true
_dropPanelCancel = dropPanelCancelComponent.createObject(toolStrip.parent)
} }
function hide() { function hide() {
if (_dropPanelCancel) {
_dropPanelCancel.destroy()
}
if (visible) { if (visible) {
visible = false visible = false
_dropDownComponent = undefined _dropDownComponent = undefined
...@@ -101,6 +106,17 @@ Item { ...@@ -101,6 +106,17 @@ Item {
QGCPalette { id: qgcPal } QGCPalette { id: qgcPal }
Component {
// Overlay which is used to cancel the panel when the user clicks away
id: dropPanelCancelComponent
MouseArea {
anchors.fill: parent
z: toolStrip.z - 1
onClicked: dropPanel.hide()
}
}
Item { Item {
id: dropDownItem id: dropDownItem
......
...@@ -47,16 +47,6 @@ Rectangle { ...@@ -47,16 +47,6 @@ Rectangle {
} }
} }
MouseArea {
x: -_root.x
y: -_root.y
width: _root.parent.width
height: _root.parent.height
visible: dropPanel.visible
onClicked: dropPanel.hide()
preventStealing: true
}
Column { Column {
id: buttonStripColumn id: buttonStripColumn
anchors.margins: ScreenTools.defaultFontPixelWidth / 2 anchors.margins: ScreenTools.defaultFontPixelWidth / 2
......
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