summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativeflickable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativeflickable.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp61
1 files changed, 43 insertions, 18 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index cdfdc58..6fe1522 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -85,7 +85,11 @@ qreal QDeclarativeFlickableVisibleArea::yPosition() const
void QDeclarativeFlickableVisibleArea::updateVisible()
{
QDeclarativeFlickablePrivate *p = static_cast<QDeclarativeFlickablePrivate *>(QGraphicsItemPrivate::get(flickable));
- bool pageChange = false;
+
+ bool changeX = false;
+ bool changeY = false;
+ bool changeWidth = false;
+ bool changeHeight = false;
// Vertical
const qreal viewheight = flickable->height();
@@ -95,11 +99,11 @@ void QDeclarativeFlickableVisibleArea::updateVisible()
if (pageSize != m_heightRatio) {
m_heightRatio = pageSize;
- pageChange = true;
+ changeHeight = true;
}
if (pagePos != m_yPosition) {
m_yPosition = pagePos;
- pageChange = true;
+ changeY = true;
}
// Horizontal
@@ -110,14 +114,21 @@ void QDeclarativeFlickableVisibleArea::updateVisible()
if (pageSize != m_widthRatio) {
m_widthRatio = pageSize;
- pageChange = true;
+ changeWidth = true;
}
if (pagePos != m_xPosition) {
m_xPosition = pagePos;
- pageChange = true;
+ changeX = true;
}
- if (pageChange)
- emit pageChanged();
+
+ if (changeX)
+ emit xPositionChanged(m_xPosition);
+ if (changeY)
+ emit yPositionChanged(m_yPosition);
+ if (changeWidth)
+ emit widthRatioChanged(m_widthRatio);
+ if (changeHeight)
+ emit heightRatioChanged(m_heightRatio);
}
@@ -472,9 +483,9 @@ qreal QDeclarativeFlickable::contentX() const
void QDeclarativeFlickable::setContentX(qreal pos)
{
Q_D(QDeclarativeFlickable);
- pos = qRound(pos);
d->timeline.reset(d->hData.move);
d->vTime = d->timeline.time();
+ movementXEnding();
if (-pos != d->hData.move.value()) {
d->hData.move.setValue(-pos);
viewportMoved();
@@ -490,9 +501,9 @@ qreal QDeclarativeFlickable::contentY() const
void QDeclarativeFlickable::setContentY(qreal pos)
{
Q_D(QDeclarativeFlickable);
- pos = qRound(pos);
d->timeline.reset(d->vData.move);
d->vTime = d->timeline.time();
+ movementYEnding();
if (-pos != d->vData.move.value()) {
d->vData.move.setValue(-pos);
viewportMoved();
@@ -1484,6 +1495,15 @@ void QDeclarativeFlickable::movementStarting()
void QDeclarativeFlickable::movementEnding()
{
Q_D(QDeclarativeFlickable);
+ movementXEnding();
+ movementYEnding();
+ d->hData.smoothVelocity.setValue(0);
+ d->vData.smoothVelocity.setValue(0);
+}
+
+void QDeclarativeFlickable::movementXEnding()
+{
+ Q_D(QDeclarativeFlickable);
if (d->flickingHorizontally) {
d->flickingHorizontally = false;
emit flickingChanged();
@@ -1491,13 +1511,6 @@ void QDeclarativeFlickable::movementEnding()
if (!d->flickingVertically)
emit flickEnded();
}
- if (d->flickingVertically) {
- d->flickingVertically = false;
- emit flickingChanged();
- emit flickingVerticallyChanged();
- if (!d->flickingHorizontally)
- emit flickEnded();
- }
if (!d->pressed && !d->stealMouse) {
if (d->movingHorizontally) {
d->movingHorizontally = false;
@@ -1507,6 +1520,20 @@ void QDeclarativeFlickable::movementEnding()
if (!d->movingVertically)
emit movementEnded();
}
+ }
+}
+
+void QDeclarativeFlickable::movementYEnding()
+{
+ Q_D(QDeclarativeFlickable);
+ if (d->flickingVertically) {
+ d->flickingVertically = false;
+ emit flickingChanged();
+ emit flickingVerticallyChanged();
+ if (!d->flickingHorizontally)
+ emit flickEnded();
+ }
+ if (!d->pressed && !d->stealMouse) {
if (d->movingVertically) {
d->movingVertically = false;
d->vMoved = false;
@@ -1516,8 +1543,6 @@ void QDeclarativeFlickable::movementEnding()
emit movementEnded();
}
}
- d->hData.smoothVelocity.setValue(0);
- d->vData.smoothVelocity.setValue(0);
}
void QDeclarativeFlickablePrivate::updateVelocity()