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 {
property alias _dropDownComponent: dropDownLoader.sourceComponent
property real _viewportMaxTop: 0
property real _viewportMaxBottom: parent.parent.height - parent.y
property var _dropPanelCancel
function show(panelEdgeTopPoint, panelEdgeHeight, panelComponent) {
_dropEdgeTopPoint = panelEdgeTopPoint
......@@ -54,9 +55,13 @@ Item {
_dropDownComponent = panelComponent
_calcPositions()
visible = true
_dropPanelCancel = dropPanelCancelComponent.createObject(toolStrip.parent)
}
function hide() {
if (_dropPanelCancel) {
_dropPanelCancel.destroy()
}
if (visible) {
visible = false
_dropDownComponent = undefined
......@@ -101,6 +106,17 @@ Item {
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 {
id: dropDownItem
......
......@@ -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 {
id: buttonStripColumn
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