diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2016-07-27 01:00:28 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2016-07-27 14:53:16 +0000 |
commit | 2190e3771887058587d1b7e0acbdd633aa6f5dad (patch) | |
tree | e3a05f9712a2bc5e1d67a0fcb7acab2495a29b9e /src/quick/items/qquickmousearea.cpp | |
parent | cab152f331b41a4afd73b715950e22ee36662429 (diff) |
MouseArea: press not accepted means not pressed
This changes that items that explicitly do not accept a press
event, will no longer get a cancel event.
[ChangeLog][QtQuick] MouseArea no longer thinks it's pressed when
it does not accept the press event. When a press event is not accepted,
MouseArea also no longer receives a cancel event.
Change-Id: I8419cef60d7cc32aab15e9027fafb73cc08001ba
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'src/quick/items/qquickmousearea.cpp')
-rw-r--r-- | src/quick/items/qquickmousearea.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index 33cc6c9a63..0118d882af 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -405,8 +405,7 @@ bool QQuickMouseAreaPrivate::propagateHelper(QQuickMouseEvent *ev, QQuickItem *i /*! \qmlsignal QtQuick::MouseArea::canceled() - This signal is emitted when mouse events have been canceled, either because an event was not accepted, or - because another item stole the mouse event handling. + This signal is emitted when mouse events have been canceled, because another item stole the mouse event handling. This signal is for advanced use: it is useful when there is more than one MouseArea that is handling input, or when there is a MouseArea inside a \l Flickable. In the latter @@ -1198,6 +1197,11 @@ bool QQuickMouseArea::setPressed(Qt::MouseButton button, bool p, Qt::MouseEventS emit mouseXChanged(&me); me.setPosition(d->lastPos); emit mouseYChanged(&me); + + if (!me.isAccepted()) { + d->pressed = Qt::NoButton; + } + if (!oldPressed) { emit pressedChanged(); emit containsPressChanged(); |