summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativegridview.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-06-24 05:56:05 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-06-24 05:56:05 (GMT)
commit768209aebcbc66fec3a600be0a0f0e58d9f405d8 (patch)
treeedfec1bb6966b5070f5b141100a407695ba920f2 /src/declarative/graphicsitems/qdeclarativegridview.cpp
parent1b4d6818865548b752008242ddbea6a4e5206684 (diff)
downloadQt-768209aebcbc66fec3a600be0a0f0e58d9f405d8.zip
Qt-768209aebcbc66fec3a600be0a0f0e58d9f405d8.tar.gz
Qt-768209aebcbc66fec3a600be0a0f0e58d9f405d8.tar.bz2
Restore neutral movement state if a view is manually positioned.
Make sure the previous movement state is cancelled if contentX or contentY are set directly. Task-number: QTBUG-11650
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativegridview.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index af9b04e..dda1efb 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -151,9 +151,9 @@ public:
void setPosition(qreal pos) {
Q_Q(QDeclarativeGridView);
if (flow == QDeclarativeGridView::LeftToRight)
- q->setContentY(pos);
+ q->QDeclarativeFlickable::setContentY(pos);
else
- q->setContentX(pos);
+ q->QDeclarativeFlickable::setContentX(pos);
}
int size() const {
Q_Q(const QDeclarativeGridView);
@@ -1742,6 +1742,22 @@ void QDeclarativeGridView::setHeader(QDeclarativeComponent *header)
}
}
+void QDeclarativeGridView::setContentX(qreal pos)
+{
+ Q_D(QDeclarativeGridView);
+ // Positioning the view manually should override any current movement state
+ d->moveReason = QDeclarativeGridViewPrivate::Other;
+ QDeclarativeFlickable::setContentX(pos);
+}
+
+void QDeclarativeGridView::setContentY(qreal pos)
+{
+ Q_D(QDeclarativeGridView);
+ // Positioning the view manually should override any current movement state
+ d->moveReason = QDeclarativeGridViewPrivate::Other;
+ QDeclarativeFlickable::setContentY(pos);
+}
+
bool QDeclarativeGridView::event(QEvent *event)
{
Q_D(QDeclarativeGridView);
@@ -2144,6 +2160,7 @@ void QDeclarativeGridView::componentComplete()
d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos());
d->updateTrackedItem();
}
+ d->moveReason = QDeclarativeGridViewPrivate::Other;
d->fixupPosition();
}
}