diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-02-02 23:42:32 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-02-02 23:42:32 (GMT) |
commit | 778e902e675a4fb2680012f9bf1221abd3b13981 (patch) | |
tree | e6acb6672417d9778f894add22112484ab8a419c /src/declarative | |
parent | 241a82b99e149d286980e3a8e5bd6ad996d8eb65 (diff) | |
parent | dea94ac9d18f8bb72d20ec4bcfd48bbf1b03fec0 (diff) | |
download | Qt-778e902e675a4fb2680012f9bf1221abd3b13981.zip Qt-778e902e675a4fb2680012f9bf1221abd3b13981.tar.gz Qt-778e902e675a4fb2680012f9bf1221abd3b13981.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsflickable.cpp | 26 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsflickable_p.h | 1 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicslistview.cpp | 6 |
3 files changed, 31 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp b/src/declarative/graphicsitems/qmlgraphicsflickable.cpp index da031f1..df8c275 100644 --- a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsflickable.cpp @@ -819,6 +819,32 @@ void QmlGraphicsFlickable::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) } } +void QmlGraphicsFlickable::wheelEvent(QGraphicsSceneWheelEvent *event) +{ + Q_D(QmlGraphicsFlickable); + if (!d->interactive) { + QmlGraphicsItem::wheelEvent(event); + } else if (yflick()) { + if (event->delta() > 0) + d->velocityY = qMax(event->delta() - d->verticalVelocity.value(), 250.0); + else + d->velocityY = qMin(event->delta() - d->verticalVelocity.value(), -250.0); + d->flicked = false; + d->flickY(d->velocityY); + event->accept(); + } else if (xflick()) { + if (event->delta() > 0) + d->velocityX = qMax(event->delta() - d->horizontalVelocity.value(), 250.0); + else + d->velocityX = qMin(event->delta() - d->horizontalVelocity.value(), -250.0); + d->flicked = false; + d->flickX(d->velocityX); + event->accept(); + } else { + QmlGraphicsItem::wheelEvent(event); + } +} + void QmlGraphicsFlickablePrivate::captureDelayedPress(QGraphicsSceneMouseEvent *event) { Q_Q(QmlGraphicsFlickable); diff --git a/src/declarative/graphicsitems/qmlgraphicsflickable_p.h b/src/declarative/graphicsitems/qmlgraphicsflickable_p.h index df6f6b1..ea07da4 100644 --- a/src/declarative/graphicsitems/qmlgraphicsflickable_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsflickable_p.h @@ -166,6 +166,7 @@ protected: void mousePressEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + void wheelEvent(QGraphicsSceneWheelEvent *event); void timerEvent(QTimerEvent *event); QmlGraphicsFlickableVisibleArea *visibleArea(); diff --git a/src/declarative/graphicsitems/qmlgraphicslistview.cpp b/src/declarative/graphicsitems/qmlgraphicslistview.cpp index f984081..8bde152 100644 --- a/src/declarative/graphicsitems/qmlgraphicslistview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicslistview.cpp @@ -2114,12 +2114,14 @@ void QmlGraphicsListView::viewportMoved() const qreal minX = minXExtent(); if ((minX - d->_moveX.value() < height()/2 || d->flickTargetX - d->_moveX.value() < height()/2) && minX != d->flickTargetX) - d->flickX(-d->verticalVelocity.value()); + d->flickX(-d->horizontalVelocity.value()); + d->bufferMode = QmlGraphicsListViewPrivate::BufferBefore; } else if (d->velocityX < 0) { const qreal maxX = maxXExtent(); if ((d->_moveX.value() - maxX < height()/2 || d->_moveX.value() - d->flickTargetX < height()/2) && maxX != d->flickTargetX) - d->flickX(-d->verticalVelocity.value()); + d->flickX(-d->horizontalVelocity.value()); + d->bufferMode = QmlGraphicsListViewPrivate::BufferAfter; } } d->inFlickCorrection = false; |