Commit 02980062 authored by Don Gagne's avatar Don Gagne

Modified DropPanel cancel MouseArea creation

Previous mechanism was exposing possible bug in Qt which would prevent
clicks from work on ToolStrip buttons after cancel MouseArea was hidden.
parent 5c0dfa95
...@@ -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