aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlbert Astals Cid <albert.astals@canonical.com>2014-07-23 15:40:42 +0200
committerAlbert Astals Cid <albert.astals@canonical.com>2014-07-28 15:07:19 +0200
commit8454a21b837ccf3968f6dbc56ed4f06d60d63c8f (patch)
treee88906c30471ccc9cbde60c4f1572f332798cb88 /src
parentdb7d66077e92e1ea4231d09c67bb14536e792cd6 (diff)
Flickable: Cancel interaction on interactive changes
Otherwise if you have a listview with a flickable inside with a mouseare inside the pressed is never set to false if you make the interactive property of the outer list depend on the moving of the inner flickable. This makes that when later you change currentIndex of the list and you have StrictlyEnforceRange set, the list won't move because it still thinks it is pressed Change-Id: I2c2021f486fc0a31840c3f2199bc7cb76dc01e3e Reviewed-by: Martin Jones <martin.jones@jollamobile.com>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquickflickable.cpp41
-rw-r--r--src/quick/items/qquickflickable_p_p.h2
2 files changed, 22 insertions, 21 deletions
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index ee71ea8a76..63dde661d9 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -763,15 +763,8 @@ void QQuickFlickable::setInteractive(bool interactive)
Q_D(QQuickFlickable);
if (interactive != d->interactive) {
d->interactive = interactive;
- if (!interactive && (d->hData.flicking || d->vData.flicking)) {
- d->clearTimeline();
- d->hData.vTime = d->vData.vTime = d->timeline.time();
- d->hData.flicking = false;
- d->vData.flicking = false;
- emit flickingChanged();
- emit flickingHorizontallyChanged();
- emit flickingVerticallyChanged();
- emit flickEnded();
+ if (!interactive) {
+ d->cancelInteraction();
}
emit interactiveChanged();
}
@@ -2015,18 +2008,24 @@ bool QQuickFlickable::yflick() const
void QQuickFlickable::mouseUngrabEvent()
{
Q_D(QQuickFlickable);
- if (d->pressed) {
- // if our mouse grab has been removed (probably by another Flickable),
- // fix our state
- d->clearDelayedPress();
- d->pressed = false;
- d->draggingEnding();
- d->stealMouse = false;
- setKeepMouseGrab(false);
- d->fixupX();
- d->fixupY();
- if (!d->isViewMoving())
- movementEnding();
+ // if our mouse grab has been removed (probably by another Flickable),
+ // fix our state
+ d->cancelInteraction();
+}
+
+void QQuickFlickablePrivate::cancelInteraction()
+{
+ Q_Q(QQuickFlickable);
+ if (pressed) {
+ clearDelayedPress();
+ pressed = false;
+ draggingEnding();
+ stealMouse = false;
+ q->setKeepMouseGrab(false);
+ fixupX();
+ fixupY();
+ if (!isViewMoving())
+ q->movementEnding();
}
}
diff --git a/src/quick/items/qquickflickable_p_p.h b/src/quick/items/qquickflickable_p_p.h
index 33a642eb69..13af2e055c 100644
--- a/src/quick/items/qquickflickable_p_p.h
+++ b/src/quick/items/qquickflickable_p_p.h
@@ -200,6 +200,8 @@ public:
bool isViewMoving() const;
+ void cancelInteraction();
+
public:
QQuickItem *contentItem;