summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qmlgraphicsflickable.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-01-27 05:46:20 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-01-27 05:46:20 (GMT)
commitb043e1fb417353de3bfcb33fe8fb91c9d97b0f8c (patch)
tree6ccdaa8e070620168ccd13938f0da3ef901d8b8d /src/declarative/graphicsitems/qmlgraphicsflickable.cpp
parent9d74b306d099685ecdde906d8336ab915f948c4f (diff)
downloadQt-b043e1fb417353de3bfcb33fe8fb91c9d97b0f8c.zip
Qt-b043e1fb417353de3bfcb33fe8fb91c9d97b0f8c.tar.gz
Qt-b043e1fb417353de3bfcb33fe8fb91c9d97b0f8c.tar.bz2
Don't react to mouse when !interactive. Allow fixup delay to be adjusted.
Diffstat (limited to 'src/declarative/graphicsitems/qmlgraphicsflickable.cpp')
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsflickable.cpp38
1 files changed, 24 insertions, 14 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp b/src/declarative/graphicsitems/qmlgraphicsflickable.cpp
index ba17115..e87f624 100644
--- a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsflickable.cpp
@@ -158,7 +158,7 @@ QmlGraphicsFlickablePrivate::QmlGraphicsFlickablePrivate()
, vWidth(-1), vHeight(-1), overShoot(true), flicked(false), moving(false), stealMouse(false)
, pressed(false), atXEnd(false), atXBeginning(true), atYEnd(false), atYBeginning(true)
, interactive(true), deceleration(500), maxVelocity(2000), reportedVelocitySmoothing(100)
- , delayedPressEvent(0), delayedPressTarget(0), pressDelay(0)
+ , delayedPressEvent(0), delayedPressTarget(0), pressDelay(0), fixupDuration(200)
, horizontalVelocity(this), verticalVelocity(this), vTime(0), visibleArea(0)
, flickDirection(QmlGraphicsFlickable::AutoFlickDirection)
{
@@ -265,11 +265,11 @@ void QmlGraphicsFlickablePrivate::fixupX()
if (_moveX.value() > q->minXExtent() || (q->maxXExtent() > q->minXExtent())) {
timeline.reset(_moveX);
if (_moveX.value() != q->minXExtent())
- timeline.move(_moveX, q->minXExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200);
+ timeline.move(_moveX, q->minXExtent(), QEasingCurve(QEasingCurve::InOutQuad), fixupDuration);
//emit flickingChanged();
} else if (_moveX.value() < q->maxXExtent()) {
timeline.reset(_moveX);
- timeline.move(_moveX, q->maxXExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200);
+ timeline.move(_moveX, q->maxXExtent(), QEasingCurve(QEasingCurve::InOutQuad), fixupDuration);
//emit flickingChanged();
} else {
flicked = false;
@@ -286,12 +286,16 @@ void QmlGraphicsFlickablePrivate::fixupY()
if (_moveY.value() > q->minYExtent() || (q->maxYExtent() > q->minYExtent())) {
timeline.reset(_moveY);
- if (_moveY.value() != q->minYExtent())
- timeline.move(_moveY, q->minYExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200);
+ if (_moveY.value() != q->minYExtent()) {
+ if (fixupDuration)
+ timeline.move(_moveY, q->minYExtent(), QEasingCurve(QEasingCurve::InOutQuad), fixupDuration);
+ else
+ _moveY.setValue(q->minYExtent());
+ }
//emit flickingChanged();
} else if (_moveY.value() < q->maxYExtent()) {
timeline.reset(_moveY);
- timeline.move(_moveY, q->maxYExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200);
+ timeline.move(_moveY, q->maxYExtent(), QEasingCurve(QEasingCurve::InOutQuad), fixupDuration);
//emit flickingChanged();
} else {
flicked = false;
@@ -773,24 +777,30 @@ void QmlGraphicsFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEve
void QmlGraphicsFlickable::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QmlGraphicsFlickable);
- d->handleMousePressEvent(event);
- event->accept();
+ if (d->interactive) {
+ d->handleMousePressEvent(event);
+ event->accept();
+ }
}
void QmlGraphicsFlickable::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QmlGraphicsFlickable);
- d->handleMouseMoveEvent(event);
- event->accept();
+ if (d->interactive) {
+ d->handleMouseMoveEvent(event);
+ event->accept();
+ }
}
void QmlGraphicsFlickable::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QmlGraphicsFlickable);
- d->clearDelayedPress();
- d->handleMouseReleaseEvent(event);
- event->accept();
- ungrabMouse();
+ if (d->interactive) {
+ d->clearDelayedPress();
+ d->handleMouseReleaseEvent(event);
+ event->accept();
+ ungrabMouse();
+ }
}
void QmlGraphicsFlickablePrivate::captureDelayedPress(QGraphicsSceneMouseEvent *event)