From 811fd7d3807410fa796c956809c4dd39e7043d10 Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 9 Apr 2015 17:06:05 +0200 Subject: [PATCH] fixed some mousearea issues --- mix/InverseMouseArea.cpp | 2 +- mix/InverseMouseArea.h | 2 +- mix/qml/StatesComboBox.qml | 11 +++++------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/mix/InverseMouseArea.cpp b/mix/InverseMouseArea.cpp index 869af60cf..9a29513a7 100644 --- a/mix/InverseMouseArea.cpp +++ b/mix/InverseMouseArea.cpp @@ -39,7 +39,7 @@ bool InverseMouseArea::eventFilter(QObject* _obj, QEvent* _ev) { Q_UNUSED(_obj); if (this->m_active && _ev->type() == QEvent::MouseButtonPress && !this->contains(static_cast(_ev)->pos())) - emit clickedOutside(); + emit clickedOutside(QPointF(static_cast(_ev)->pos())); return false; } diff --git a/mix/InverseMouseArea.h b/mix/InverseMouseArea.h index 893c7b9c6..0d19e0f1b 100644 --- a/mix/InverseMouseArea.h +++ b/mix/InverseMouseArea.h @@ -49,7 +49,7 @@ private: bool m_active; signals: - void clickedOutside(); + void clickedOutside(QPointF _point); }; } diff --git a/mix/qml/StatesComboBox.qml b/mix/qml/StatesComboBox.qml index 62758cbe4..907580ee7 100644 --- a/mix/qml/StatesComboBox.qml +++ b/mix/qml/StatesComboBox.qml @@ -99,11 +99,10 @@ Rectangle { } MouseArea { + id: selectorArea anchors.fill: parent onClicked: { - if (outsideClick.trigerred) - outsideClick.trigerred = false; - else if (statesCombo.state === "") + if (statesCombo.state === "") statesCombo.state = "dropDown"; } } @@ -133,13 +132,13 @@ Rectangle { InverseMouseArea { - property bool trigerred: false id: outsideClick anchors.fill: parent active: false onClickedOutside: { - trigerred = true; - statesCombo.hideDropDown() + var p = selectorArea.mapFromItem(null, _point.x, _point.y); + if (!selectorArea.contains(Qt.point(p.x, p.y))) + statesCombo.hideDropDown() } }