From 67ca33d53ff805ca33ba775524086a89cb975df9 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 28 Aug 2009 16:42:02 +1000 Subject: Make a number of Flickable API changes following review. --- demos/declarative/contacts/contacts.qml | 4 +- demos/declarative/flickr/common/ImageDetails.qml | 8 +- demos/declarative/webbrowser/webbrowser.qml | 18 ++--- doc/src/tutorials/declarative.qdoc | 2 +- examples/declarative/velocity/Day.qml | 2 +- src/declarative/QmlChanges.txt | 5 ++ src/declarative/fx/qfxflickable.cpp | 98 ++++++++++++------------ src/declarative/fx/qfxflickable.h | 55 ++++++------- src/declarative/fx/qfxflickable_p.h | 12 +-- src/declarative/fx/qfxgridview.cpp | 6 +- src/declarative/fx/qfxlistview.cpp | 6 +- 11 files changed, 113 insertions(+), 103 deletions(-) diff --git a/demos/declarative/contacts/contacts.qml b/demos/declarative/contacts/contacts.qml index ebcab69..81d8352 100644 --- a/demos/declarative/contacts/contacts.qml +++ b/demos/declarative/contacts/contacts.qml @@ -101,7 +101,7 @@ Rectangle { } PropertyChanges { target: contactListView - yPosition: wrapper.y + viewportY: wrapper.y } PropertyChanges { target: contactListView @@ -121,7 +121,7 @@ Rectangle { Transition { NumberAnimation { duration: 500 - properties: "yPosition,height,opacity" + properties: "viewportY,height,opacity" } } ] diff --git a/demos/declarative/flickr/common/ImageDetails.qml b/demos/declarative/flickr/common/ImageDetails.qml index 8098273..dcd44eb 100644 --- a/demos/declarative/flickr/common/ImageDetails.qml +++ b/demos/declarative/flickr/common/ImageDetails.qml @@ -121,12 +121,12 @@ Flipable { id: Slider; x: 25; y: 374; visible: { BigImage.status == 1 && maximum > minimum } onValueChanged: { if (BigImage.width * value > Flick.width) { - var xoff = (Flick.width/2 + Flick.xPosition) * value / prevScale; - Flick.xPosition = xoff - Flick.width/2; + var xoff = (Flick.width/2 + Flick.viewportX) * value / prevScale; + Flick.viewportX = xoff - Flick.width/2; } if (BigImage.height * value > Flick.height) { - var yoff = (Flick.height/2 + Flick.yPosition) * value / prevScale; - Flick.yPosition = yoff - Flick.height/2; + var yoff = (Flick.height/2 + Flick.viewportY) * value / prevScale; + Flick.viewportY = yoff - Flick.height/2; } prevScale = value; } diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index ec3a2a0..126fa87 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -48,8 +48,8 @@ Item { anchors.bottom: Footer.top } RectSoftShadow { - x: -Flick.xPosition - y: -Flick.yPosition + x: -Flick.viewportX + y: -Flick.viewportY width: MyWebView.width*MyWebView.scale height: Flick.y+MyWebView.height*MyWebView.scale } @@ -72,10 +72,10 @@ Item { width: parent.width height: 64 state: "Normal" - x: Flick.xPosition < 0 ? -Flick.xPosition : Flick.xPosition > Flick.viewportWidth-Flick.width - ? -Flick.xPosition+Flick.viewportWidth-Flick.width : 0 - y: Flick.yPosition < 0 ? -Flick.yPosition : progressOff* - (Flick.yPosition>height?-height:-Flick.yPosition) + x: Flick.viewportX < 0 ? -Flick.viewportX : Flick.viewportX > Flick.viewportWidth-Flick.width + ? -Flick.viewportX+Flick.viewportWidth-Flick.width : 0 + y: Flick.viewportY < 0 ? -Flick.viewportY : progressOff* + (Flick.viewportY>height?-height:-Flick.viewportY) Text { id: HeaderText @@ -335,8 +335,8 @@ Item { State { name: "Normal" PropertyChanges { target: MyWebView; zoomedOut: 0 } - PropertyChanges { target: Flick; explicit: true; xPosition: Math.min(MyWebView.width-Flick.width,Math.max(0,Flick.centerX-Flick.width/2)) } - PropertyChanges { target: Flick; explicit: true; yPosition: Math.min(MyWebView.height-Flick.height,Math.max(0,Flick.centerY-Flick.height/2)) } + PropertyChanges { target: Flick; explicit: true; viewportX: Math.min(MyWebView.width-Flick.width,Math.max(0,Flick.centerX-Flick.width/2)) } + PropertyChanges { target: Flick; explicit: true; viewportY: Math.min(MyWebView.height-Flick.height,Math.max(0,Flick.centerY-Flick.height/2)) } }, State { name: "ZoomedOut" @@ -360,7 +360,7 @@ Item { } NumberAnimation { target: Flick - properties: "xPosition,yPosition" + properties: "viewportX,viewportY" easing: "easeInOutQuad" duration: 200 } diff --git a/doc/src/tutorials/declarative.qdoc b/doc/src/tutorials/declarative.qdoc index dde0615..7780988 100644 --- a/doc/src/tutorials/declarative.qdoc +++ b/doc/src/tutorials/declarative.qdoc @@ -614,7 +614,7 @@ This defines the open state of the delegate. It changes the height of the delegate component to that of the whole list view, pushing the other items off each end of - the list. It sets the lists views scroll yPosition of the ListView to the + the list. It sets the listview's scroll viewportY of the ListView to the y value of the delegate so that the top of the delegate matches the top of the list view. The next step is to lock the list view. This prevents the user being able to flick the list view. The final to properties that are set should diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index 1a336b7..06d0bd4 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -32,7 +32,7 @@ Rectangle { y: Math.random() * 300 + 50 id: StickyPage rotation: Follow { - source: -Flick.xVelocity / 100 + source: -Flick.horizontalVelocity / 100 spring: 2.0 damping: 0.1 } diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index e01b9af..e760037 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -42,6 +42,11 @@ Transition: operations -> animations Transition: fromState -> from Transition: toState -> to Follow: followValue -> value +Flickable: xPosition -> viewportX +Flickable: yPosition -> viewportY +Flickable: xVelocity -> horizontalVelocity +Flickable: yVelocity -> verticalVelocity +Flickable: velocityDecay -> reportedVelocitySmoothing Additions: MouseRegion: add "acceptedButtons" property diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index ea38026..07df799 100644 --- a/src/declarative/fx/qfxflickable.cpp +++ b/src/declarative/fx/qfxflickable.cpp @@ -96,7 +96,7 @@ QFxFlickablePrivate::QFxFlickablePrivate() : _flick(new QFxItem), _moveX(_flick, &QFxItem::setX), _moveY(_flick, &QFxItem::setY) , vWidth(-1), vHeight(-1), overShoot(true), flicked(false), moving(false), stealMouse(false) , pressed(false), maxVelocity(-1), locked(false), dragMode(QFxFlickable::Hard) - , elasticY(_moveY), elasticX(_moveX), velocityDecay(100), xVelocity(this), yVelocity(this) + , elasticY(_moveY), elasticX(_moveX), reportedVelocitySmoothing(100), horizontalVelocity(this), verticalVelocity(this) , vTime(0), atXEnd(false), atXBeginning(true), pageXPosition(0.), pageWidth(0.) , atYEnd(false), atYBeginning(true), pageYPosition(0.), pageHeight(0.) { @@ -112,8 +112,8 @@ void QFxFlickablePrivate::init() QObject::connect(&_tl, SIGNAL(completed()), q, SLOT(movementEnding())); q->setAcceptedMouseButtons(Qt::LeftButton); q->setFiltersChildEvents(true); - QObject::connect(_flick, SIGNAL(xChanged()), q, SIGNAL(positionChanged())); - QObject::connect(_flick, SIGNAL(yChanged()), q, SIGNAL(positionChanged())); + QObject::connect(_flick, SIGNAL(xChanged()), q, SIGNAL(positionXChanged())); + QObject::connect(_flick, SIGNAL(yChanged()), q, SIGNAL(positionYChanged())); QObject::connect(&elasticX, SIGNAL(updated()), q, SLOT(ticked())); QObject::connect(&elasticY, SIGNAL(updated()), q, SLOT(ticked())); QObject::connect(q, SIGNAL(heightChanged()), q, SLOT(heightChange())); @@ -369,20 +369,20 @@ QFxFlickable::~QFxFlickable() } /*! - \qmlproperty int Flickable::xPosition - \qmlproperty int Flickable::yPosition + \qmlproperty int Flickable::viewportX + \qmlproperty int Flickable::viewportY These properties hold the surface coordinate currently at the top-left corner of the Flickable. For example, if you flick an image up 100 pixels, \c yPosition will be 100. */ -qreal QFxFlickable::xPosition() const +qreal QFxFlickable::viewportX() const { Q_D(const QFxFlickable); return -d->_moveX.value(); } -void QFxFlickable::setXPosition(qreal pos) +void QFxFlickable::setViewportX(qreal pos) { Q_D(QFxFlickable); pos = qRound(pos); @@ -393,13 +393,13 @@ void QFxFlickable::setXPosition(qreal pos) } } -qreal QFxFlickable::yPosition() const +qreal QFxFlickable::viewportY() const { Q_D(const QFxFlickable); return -d->_moveY.value(); } -void QFxFlickable::setYPosition(qreal pos) +void QFxFlickable::setViewportY(qreal pos) { Q_D(QFxFlickable); pos = qRound(pos); @@ -454,21 +454,25 @@ void QFxFlickable::setDragMode(DragMode mode) } /*! - \qmlproperty real Flickable::xVelocity - \qmlproperty real Flickable::yVelocity + \qmlproperty real Flickable::horizontalVelocity + \qmlproperty real Flickable::verticalVelocity + \qmlproperty real Flickable::reportedVelocitySmoothing The instantaneous velocity of movement along the x and y axes, in pixels/sec. + + The reported velocity is smoothed to avoid erratic output. + reportedVelocitySmoothing determines how much smoothing is applied. */ -qreal QFxFlickable::xVelocity() const +qreal QFxFlickable::horizontalVelocity() const { Q_D(const QFxFlickable); - return d->xVelocity.value(); + return d->horizontalVelocity.value(); } -qreal QFxFlickable::yVelocity() const +qreal QFxFlickable::verticalVelocity() const { Q_D(const QFxFlickable); - return d->yVelocity.value(); + return d->verticalVelocity.value(); } /*! @@ -760,18 +764,18 @@ void QFxFlickable::viewportMoved() qreal prevX = d->lastFlickablePosition.y(); d->velocityTimeline.clear(); if (d->pressed) { - qreal xVelocity = (prevX - d->_moveX.value()) * 1000 / elapsed; - qreal yVelocity = (prevY - d->_moveY.value()) * 1000 / elapsed; - d->velocityTimeline.move(d->xVelocity, xVelocity, d->velocityDecay); - d->velocityTimeline.move(d->xVelocity, 0, d->velocityDecay); - d->velocityTimeline.move(d->yVelocity, yVelocity, d->velocityDecay); - d->velocityTimeline.move(d->yVelocity, 0, d->velocityDecay); + qreal horizontalVelocity = (prevX - d->_moveX.value()) * 1000 / elapsed; + qreal verticalVelocity = (prevY - d->_moveY.value()) * 1000 / elapsed; + d->velocityTimeline.move(d->horizontalVelocity, horizontalVelocity, d->reportedVelocitySmoothing); + d->velocityTimeline.move(d->horizontalVelocity, 0, d->reportedVelocitySmoothing); + d->velocityTimeline.move(d->verticalVelocity, verticalVelocity, d->reportedVelocitySmoothing); + d->velocityTimeline.move(d->verticalVelocity, 0, d->reportedVelocitySmoothing); } else { if (d->_tl.time() != d->vTime) { - qreal xVelocity = (prevX - d->_moveX.value()) * 1000 / (d->_tl.time() - d->vTime); - qreal yVelocity = (prevY - d->_moveY.value()) * 1000 / (d->_tl.time() - d->vTime); - d->xVelocity.setValue(xVelocity); - d->yVelocity.setValue(yVelocity); + qreal horizontalVelocity = (prevX - d->_moveX.value()) * 1000 / (d->_tl.time() - d->vTime); + qreal verticalVelocity = (prevY - d->_moveY.value()) * 1000 / (d->_tl.time() - d->vTime); + d->horizontalVelocity.setValue(horizontalVelocity); + d->verticalVelocity.setValue(verticalVelocity); } d->vTime = d->_tl.time(); } @@ -787,21 +791,21 @@ void QFxFlickable::viewportMoved() if (d->velocityY > 0) { const qreal minY = minYExtent(); if (minY - d->_moveY.value() < height()/3 && minY != d->flickTargetY) - d->flickY(-d->yVelocity.value()); + d->flickY(-d->verticalVelocity.value()); } else { const qreal maxY = maxYExtent(); if (d->_moveY.value() - maxY < height()/3 && maxY != d->flickTargetY) - d->flickY(-d->yVelocity.value()); + d->flickY(-d->verticalVelocity.value()); } if (d->velocityX > 0) { const qreal minX = minXExtent(); if (minX - d->_moveX.value() < height()/3 && minX != d->flickTargetX) - d->flickX(-d->xVelocity.value()); + d->flickX(-d->horizontalVelocity.value()); } else { const qreal maxX = maxXExtent(); if (d->_moveX.value() - maxX < height()/3 && maxX != d->flickTargetX) - d->flickX(-d->xVelocity.value()); + d->flickX(-d->horizontalVelocity.value()); } } } @@ -892,13 +896,13 @@ void QFxFlickable::setOverShoot(bool o) } \endcode */ -int QFxFlickable::viewportWidth() const +qreal QFxFlickable::viewportWidth() const { Q_D(const QFxFlickable); return d->vWidth; } -void QFxFlickable::setViewportWidth(int w) +void QFxFlickable::setViewportWidth(qreal w) { Q_D(QFxFlickable); if (d->vWidth == w) @@ -935,13 +939,13 @@ void QFxFlickable::heightChange() } } -int QFxFlickable::viewportHeight() const +qreal QFxFlickable::viewportHeight() const { Q_D(const QFxFlickable); return d->vHeight; } -void QFxFlickable::setViewportHeight(int h) +void QFxFlickable::setViewportHeight(qreal h) { Q_D(QFxFlickable); if (d->vHeight == h) @@ -958,7 +962,7 @@ void QFxFlickable::setViewportHeight(int h) d->updateBeginningEnd(); } -int QFxFlickable::vWidth() const +qreal QFxFlickable::vWidth() const { Q_D(const QFxFlickable); if (d->vWidth < 0) @@ -967,7 +971,7 @@ int QFxFlickable::vWidth() const return d->vWidth; } -int QFxFlickable::vHeight() const +qreal QFxFlickable::vHeight() const { Q_D(const QFxFlickable); if (d->vHeight < 0) @@ -1049,15 +1053,15 @@ bool QFxFlickable::sceneEventFilter(QGraphicsItem *i, QEvent *e) /*! \qmlproperty int Flickable::maximumFlickVelocity - This property holds the maximum velocity that the user can flick the view. + This property holds the maximum velocity that the user can flick the view in pixels/second. */ -int QFxFlickable::maximumFlickVelocity() const +qreal QFxFlickable::maximumFlickVelocity() const { Q_D(const QFxFlickable); return d->maxVelocity; } -void QFxFlickable::setMaximumFlickVelocity(int v) +void QFxFlickable::setMaximumFlickVelocity(qreal v) { Q_D(QFxFlickable); if (v == d->maxVelocity) @@ -1071,20 +1075,20 @@ bool QFxFlickable::isFlicking() const return d->flicked; } -int QFxFlickable::velocityDecay() const +qreal QFxFlickable::reportedVelocitySmoothing() const { Q_D(const QFxFlickable); - return d->velocityDecay; + return d->reportedVelocitySmoothing; } -void QFxFlickable::setVelocityDecay(int decay) +void QFxFlickable::setReportedVelocitySmoothing(qreal reportedVelocitySmoothing) { Q_D(QFxFlickable); - Q_ASSERT(decay >= 0); - if (decay == d->velocityDecay) + Q_ASSERT(reportedVelocitySmoothing >= 0); + if (reportedVelocitySmoothing == d->reportedVelocitySmoothing) return; - d->velocityDecay = decay; - emit velocityDecayChanged(decay); + d->reportedVelocitySmoothing = reportedVelocitySmoothing; + emit reportedVelocitySmoothingChanged(reportedVelocitySmoothing); } bool QFxFlickable::isMoving() const @@ -1116,13 +1120,13 @@ void QFxFlickable::movementEnding() emit flickingChanged(); emit flickEnded(); } - d->xVelocity.setValue(0); + d->horizontalVelocity.setValue(0); } void QFxFlickablePrivate::updateVelocity() { Q_Q(QFxFlickable); - emit q->velocityChanged(q->xVelocity(), q->yVelocity()); + emit q->velocityChanged(q->horizontalVelocity(), q->verticalVelocity()); } QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxflickable.h b/src/declarative/fx/qfxflickable.h index 13d793f..c27b29f 100644 --- a/src/declarative/fx/qfxflickable.h +++ b/src/declarative/fx/qfxflickable.h @@ -55,17 +55,17 @@ class Q_DECLARATIVE_EXPORT QFxFlickable : public QFxItem { Q_OBJECT - Q_PROPERTY(bool overShoot READ overShoot WRITE setOverShoot) - Q_PROPERTY(int viewportWidth READ viewportWidth WRITE setViewportWidth NOTIFY viewportWidthChanged) //### qreal - Q_PROPERTY(int viewportHeight READ viewportHeight WRITE setViewportHeight NOTIFY viewportHeightChanged) - Q_PROPERTY(qreal xPosition READ xPosition WRITE setXPosition NOTIFY positionChanged) //### viewportX, positionXChannged - Q_PROPERTY(qreal yPosition READ yPosition WRITE setYPosition NOTIFY positionChanged) //### ^^^ + Q_PROPERTY(qreal viewportWidth READ viewportWidth WRITE setViewportWidth NOTIFY viewportWidthChanged) + Q_PROPERTY(qreal viewportHeight READ viewportHeight WRITE setViewportHeight NOTIFY viewportHeightChanged) + Q_PROPERTY(qreal viewportX READ viewportX WRITE setViewportX NOTIFY positionXChanged) + Q_PROPERTY(qreal viewportY READ viewportY WRITE setViewportY NOTIFY positionYChanged) - Q_PROPERTY(int velocityDecay READ velocityDecay WRITE setVelocityDecay NOTIFY velocityDecayChanged) //### qreal deceleration - Q_PROPERTY(int maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity) ///### qreal, use same units as follow (pixels/s) + Q_PROPERTY(qreal horizontalVelocity READ horizontalVelocity NOTIFY horizontalVelocityChanged) + Q_PROPERTY(qreal verticalVelocity READ verticalVelocity NOTIFY verticalVelocityChanged) + Q_PROPERTY(qreal reportedVelocitySmoothing READ reportedVelocitySmoothing WRITE setReportedVelocitySmoothing NOTIFY reportedVelocitySmoothingChanged) - Q_PROPERTY(qreal xVelocity READ xVelocity NOTIFY velocityChanged) //### horizontalVelocity - Q_PROPERTY(qreal yVelocity READ yVelocity NOTIFY velocityChanged) //### verticalVelocity + Q_PROPERTY(bool overShoot READ overShoot WRITE setOverShoot) + Q_PROPERTY(qreal maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity) Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged) Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged) @@ -96,26 +96,26 @@ public: bool overShoot() const; void setOverShoot(bool); - int viewportWidth() const; - void setViewportWidth(int); + qreal viewportWidth() const; + void setViewportWidth(qreal); - int viewportHeight() const; - void setViewportHeight(int); + qreal viewportHeight() const; + void setViewportHeight(qreal); - qreal xPosition() const; - void setXPosition(qreal pos); + qreal viewportX() const; + void setViewportX(qreal pos); - qreal yPosition() const; - void setYPosition(qreal pos); + qreal viewportY() const; + void setViewportY(qreal pos); bool isMoving() const; bool isFlicking() const; - int velocityDecay() const; - void setVelocityDecay(int); + qreal reportedVelocitySmoothing() const; + void setReportedVelocitySmoothing(qreal); - int maximumFlickVelocity() const; - void setMaximumFlickVelocity(int); + qreal maximumFlickVelocity() const; + void setMaximumFlickVelocity(qreal); bool isLocked() const; void setLocked(bool); @@ -125,8 +125,8 @@ public: DragMode dragMode() const; void setDragMode(DragMode mode); - qreal xVelocity() const; - qreal yVelocity() const; + qreal horizontalVelocity() const; + qreal verticalVelocity() const; bool isAtXEnd() const; bool isAtXBeginning() const; @@ -143,14 +143,15 @@ public: Q_SIGNALS: void viewportWidthChanged(); void viewportHeightChanged(); - void positionChanged(); + void positionXChanged(); + void positionYChanged(); void movingChanged(); void flickingChanged(); void movementStarted(); void movementEnded(); void flickStarted(); void flickEnded(); - void velocityDecayChanged(int); + void reportedVelocitySmoothingChanged(int); void velocityChanged(qreal, qreal); void isAtBoundaryChanged(); void pageChanged(); @@ -176,8 +177,8 @@ protected: virtual qreal minYExtent() const; virtual qreal maxXExtent() const; virtual qreal maxYExtent() const; - int vWidth() const; - int vHeight() const; + qreal vWidth() const; + qreal vHeight() const; virtual void viewportMoved(); bool sendMouseEvent(QGraphicsSceneMouseEvent *event); diff --git a/src/declarative/fx/qfxflickable_p.h b/src/declarative/fx/qfxflickable_p.h index 00d5423..a0ac011 100644 --- a/src/declarative/fx/qfxflickable_p.h +++ b/src/declarative/fx/qfxflickable_p.h @@ -103,8 +103,8 @@ public: QmlTimeLineValueProxy _moveX; QmlTimeLineValueProxy _moveY; QmlTimeLine _tl; - int vWidth; - int vHeight; + qreal vWidth; + qreal vHeight; bool overShoot; bool flicked; bool moving; @@ -120,14 +120,14 @@ public: QTime pressTime; QmlTimeLineEvent fixupXEvent; QmlTimeLineEvent fixupYEvent; - int maxVelocity; + qreal maxVelocity; bool locked; QFxFlickable::DragMode dragMode; ElasticValue elasticY; ElasticValue elasticX; QTime velocityTime; QPointF lastFlickablePosition; - int velocityDecay; + qreal reportedVelocitySmoothing; int flickTargetX; int flickTargetY; @@ -142,8 +142,8 @@ public: } QFxFlickablePrivate *parent; }; - Velocity xVelocity; - Velocity yVelocity; + Velocity horizontalVelocity; + Velocity verticalVelocity; int vTime; QmlTimeLine velocityTimeline; bool atXEnd; diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index bf6e863..138a8ae 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -185,14 +185,14 @@ public: qreal position() const { Q_Q(const QFxGridView); - return flow == QFxGridView::LeftToRight ? q->yPosition() : q->xPosition(); + return flow == QFxGridView::LeftToRight ? q->viewportY() : q->viewportX(); } void setPosition(qreal pos) { Q_Q(QFxGridView); if (flow == QFxGridView::LeftToRight) - q->setYPosition(pos); + q->setViewportY(pos); else - q->setXPosition(pos); + q->setViewportX(pos); } int size() const { Q_Q(const QFxGridView); diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index c1e03dd..147c977 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -196,14 +196,14 @@ public: qreal position() const { Q_Q(const QFxListView); - return orient == Qt::Vertical ? q->yPosition() : q->xPosition(); + return orient == Qt::Vertical ? q->viewportY() : q->viewportX(); } void setPosition(qreal pos) { Q_Q(QFxListView); if (orient == Qt::Vertical) - q->setYPosition(pos); + q->setViewportY(pos); else - q->setXPosition(pos); + q->setViewportX(pos); } int size() const { Q_Q(const QFxListView); -- cgit v0.12