Browse Source

fixed some mousearea issues

cl-refactor
arkpar 10 years ago
parent
commit
811fd7d380
  1. 2
      mix/InverseMouseArea.cpp
  2. 2
      mix/InverseMouseArea.h
  3. 11
      mix/qml/StatesComboBox.qml

2
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<QMouseEvent*>(_ev)->pos()))
emit clickedOutside();
emit clickedOutside(QPointF(static_cast<QMouseEvent*>(_ev)->pos()));
return false;
}

2
mix/InverseMouseArea.h

@ -49,7 +49,7 @@ private:
bool m_active;
signals:
void clickedOutside();
void clickedOutside(QPointF _point);
};
}

11
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()
}
}

Loading…
Cancel
Save