diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-07-20 16:24:58 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-07-21 18:01:26 +0000 |
commit | 9fc9bedb2a74940bf8a4f6f55a7b59e435f2acab (patch) | |
tree | 90c9681b7754c780d41da8cd1f8783673e0ac3cb /src/imports | |
parent | 9ea40a33e91a5457f3f57edaf7485c67edfe6e28 (diff) |
Material: fix ripple wave position on mouse ungrab / button cancel
QQuickMaterialRipple compared the anchor item to QQuickWindow's
mouseGrabberItem to ensure that only mouse-pressed buttons would use the
press point, whereas key-pressed buttons would use the center point.
However, this does not work in case the mouse grab was stolen: when
first pressing an ItemDelegate and then dragging the containing ListView,
the ripple wave would always appear from the center point, not from the
press point as it should. Since QQuickAbstractButton::keyPressEvent()
sets the press point as the center of the control, the mouseGrabberItem
check can be simply removed.
Change-Id: Ic24e5e80c9d849f3fe2684013dd40b004ef55b57
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/controls/material/qquickmaterialripple.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/imports/controls/material/qquickmaterialripple.cpp b/src/imports/controls/material/qquickmaterialripple.cpp index f3bc465c..645b0289 100644 --- a/src/imports/controls/material/qquickmaterialripple.cpp +++ b/src/imports/controls/material/qquickmaterialripple.cpp @@ -309,14 +309,8 @@ QPointF QQuickMaterialRipple::anchorPoint() const return center; QPointF anchorPoint = bounds.center(); - if (QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(m_anchor)) { - if (QQuickWindow *window = button->window()) { - if (button == window->mouseGrabberItem()) { - QQuickAbstractButtonPrivate *p = QQuickAbstractButtonPrivate::get(button); - anchorPoint = p->pressPoint; - } - } - } + if (QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(m_anchor)) + anchorPoint = QQuickAbstractButtonPrivate::get(button)->pressPoint; anchorPoint = mapFromItem(m_anchor, anchorPoint); // calculate whether the anchor point is within the ripple circle bounds, |