summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2010-05-13 05:23:23 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2010-05-13 05:29:17 (GMT)
commit2e04552969f925f7e32e2757dc2ebb3e93936a03 (patch)
treea0f6303eaf24c59c73711c724abfa38be1476994 /src/declarative
parent1786d77152a3112fe6e8ab5d1e1d8703d8278d57 (diff)
downloadQt-2e04552969f925f7e32e2757dc2ebb3e93936a03.zip
Qt-2e04552969f925f7e32e2757dc2ebb3e93936a03.tar.gz
Qt-2e04552969f925f7e32e2757dc2ebb3e93936a03.tar.bz2
Follow-up on Flickable changes.
- flicking and moving properties will not be removed - onMovement* and onFlick* signals are back in Reviewed-by: Martin Jones
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/QmlChanges.txt5
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp80
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable_p.h16
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp19
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp18
5 files changed, 94 insertions, 44 deletions
diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt
index 9ab3f08..604c14c 100644
--- a/src/declarative/QmlChanges.txt
+++ b/src/declarative/QmlChanges.txt
@@ -3,10 +3,9 @@ The changes below are pre Qt 4.7.0 RC
Flickable:
- overShoot is replaced by boundsBehavior enumeration
- - flicking is replaced by flickingHorizontally and flickingVertically
- - moving is replaced by movingHorizontally and movingVertically
+ - flickingHorizontally and flickingVertically properties added
+ - movingHorizontally and movingVertically properties added
- flickDirection is renamed flickableDirection
- - onMovementStarted, onMovementEnded, onFlickStarted and onFlickEnded signals removed
Component: isReady, isLoading, isError and isNull properties removed, use
status property instead
QList<QObject*> models no longer provide properties in model object. The
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index a7a8983..a03a51d 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -230,13 +230,17 @@ void QDeclarativeFlickablePrivate::flick(AxisData &data, qreal minExtent, qreal
timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this));
if (!flickingHorizontally && q->xflick()) {
flickingHorizontally = true;
- emit q->flickingChanged(); // deprecated
+ emit q->flickingChanged();
emit q->flickingHorizontallyChanged();
+ if (!flickingVertically)
+ emit q->flickStarted();
}
if (!flickingVertically && q->yflick()) {
flickingVertically = true;
- emit q->flickingChanged(); // deprecated
+ emit q->flickingChanged();
emit q->flickingVerticallyChanged();
+ if (!flickingHorizontally)
+ emit q->flickStarted();
}
} else {
timeline.reset(data.move);
@@ -365,6 +369,37 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd()
*/
/*!
+ \qmlsignal Flickable::onMovementStarted()
+
+ This handler is called when the view begins moving due to user
+ interaction.
+*/
+
+/*!
+ \qmlsignal Flickable::onMovementEnded()
+
+ This handler is called when the view stops moving due to user
+ interaction. If a flick was generated, this handler will
+ be triggered once the flick stops. If a flick was not
+ generated, the handler will be triggered when the
+ user stops dragging - i.e. a mouse or touch release.
+*/
+
+/*!
+ \qmlsignal Flickable::onFlickStarted()
+
+ This handler is called when the view is flicked. A flick
+ starts from the point that the mouse or touch is released,
+ while still in motion.
+*/
+
+/*!
+ \qmlsignal Flickable::onFlickEnded()
+
+ This handler is called when the view stops moving due to a flick.
+*/
+
+/*!
\qmlproperty real Flickable::visibleArea.xPosition
\qmlproperty real Flickable::visibleArea.widthRatio
\qmlproperty real Flickable::visibleArea.yPosition
@@ -474,9 +509,10 @@ void QDeclarativeFlickable::setInteractive(bool interactive)
d->vTime = d->timeline.time();
d->flickingHorizontally = false;
d->flickingVertically = false;
- emit flickingChanged(); // deprecated
+ emit flickingChanged();
emit flickingHorizontallyChanged();
emit flickingVerticallyChanged();
+ emit flickEnded();
}
emit interactiveChanged();
}
@@ -799,8 +835,10 @@ void QDeclarativeFlickable::wheelEvent(QGraphicsSceneWheelEvent *event)
d->vData.velocity = qMin(event->delta() - d->vData.smoothVelocity.value(), qreal(-250.0));
d->flickingVertically = false;
d->flickY(d->vData.velocity);
- if (d->flickingVertically)
+ if (d->flickingVertically) {
+ d->vMoved = true;
movementStarting();
+ }
event->accept();
} else if (xflick()) {
if (event->delta() > 0)
@@ -809,8 +847,10 @@ void QDeclarativeFlickable::wheelEvent(QGraphicsSceneWheelEvent *event)
d->hData.velocity = qMin(event->delta() - d->hData.smoothVelocity.value(), qreal(-250.0));
d->flickingHorizontally = false;
d->flickX(d->hData.velocity);
- if (d->flickingHorizontally)
+ if (d->flickingHorizontally) {
+ d->hMoved = true;
movementStarting();
+ }
event->accept();
} else {
QDeclarativeItem::wheelEvent(event);
@@ -1269,11 +1309,11 @@ void QDeclarativeFlickable::setFlickDeceleration(qreal deceleration)
bool QDeclarativeFlickable::isFlicking() const
{
Q_D(const QDeclarativeFlickable);
- qmlInfo(this) << "'flicking' is deprecated. Please use 'flickingHorizontally' and 'flickingVertically' instead.";
return d->flickingHorizontally || d->flickingVertically;
}
/*!
+ \qmlproperty bool Flickable::flicking
\qmlproperty bool Flickable::flickingHorizontally
\qmlproperty bool Flickable::flickingVertically
@@ -1322,11 +1362,11 @@ void QDeclarativeFlickable::setPressDelay(int delay)
bool QDeclarativeFlickable::isMoving() const
{
Q_D(const QDeclarativeFlickable);
- qmlInfo(this) << "'moving' is deprecated. Please use 'movingHorizontally' or 'movingVertically' instead.";
return d->movingHorizontally || d->movingVertically;
}
/*!
+ \qmlproperty bool Flickable::moving
\qmlproperty bool Flickable::movingHorizontally
\qmlproperty bool Flickable::movingVertically
@@ -1350,13 +1390,17 @@ void QDeclarativeFlickable::movementStarting()
Q_D(QDeclarativeFlickable);
if (d->hMoved && !d->movingHorizontally) {
d->movingHorizontally = true;
- emit movingChanged(); // deprecated
+ emit movingChanged();
emit movingHorizontallyChanged();
+ if (!d->movingVertically)
+ emit movementStarted();
}
- if (d->vMoved && !d->movingVertically) {
+ else if (d->vMoved && !d->movingVertically) {
d->movingVertically = true;
- emit movingChanged(); // deprecated
+ emit movingChanged();
emit movingVerticallyChanged();
+ if (!d->movingHorizontally)
+ emit movementStarted();
}
}
@@ -1365,25 +1409,33 @@ void QDeclarativeFlickable::movementEnding()
Q_D(QDeclarativeFlickable);
if (d->flickingHorizontally) {
d->flickingHorizontally = false;
- emit flickingChanged(); // deprecated
+ emit flickingChanged();
emit flickingHorizontallyChanged();
+ if (!d->flickingVertically)
+ emit flickEnded();
}
if (d->flickingVertically) {
d->flickingVertically = false;
- emit flickingChanged(); // deprecated
+ emit flickingChanged();
emit flickingVerticallyChanged();
+ if (!d->flickingHorizontally)
+ emit flickEnded();
}
if (d->movingHorizontally) {
d->movingHorizontally = false;
d->hMoved = false;
- emit movingChanged(); // deprecated
+ emit movingChanged();
emit movingHorizontallyChanged();
+ if (!d->movingVertically)
+ emit movementEnded();
}
if (d->movingVertically) {
d->movingVertically = false;
d->vMoved = false;
- emit movingChanged(); // deprecated
+ emit movingChanged();
emit movingVerticallyChanged();
+ if (!d->movingHorizontally)
+ emit movementEnded();
}
d->hData.smoothVelocity.setValue(0);
d->vData.smoothVelocity.setValue(0);
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p.h
index 7944e2b..05887b8 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeflickable_p.h
@@ -68,10 +68,10 @@ class Q_DECLARATIVE_EXPORT QDeclarativeFlickable : public QDeclarativeItem
Q_PROPERTY(BoundsBehavior boundsBehavior READ boundsBehavior WRITE setBoundsBehavior NOTIFY boundsBehaviorChanged)
Q_PROPERTY(qreal maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity NOTIFY maximumFlickVelocityChanged)
Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration NOTIFY flickDecelerationChanged)
- Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged) // deprecated
+ Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged)
Q_PROPERTY(bool movingHorizontally READ isMovingHorizontally NOTIFY movingHorizontallyChanged)
Q_PROPERTY(bool movingVertically READ isMovingVertically NOTIFY movingVerticallyChanged)
- Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged) // deprecated
+ Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged)
Q_PROPERTY(bool flickingHorizontally READ isFlickingHorizontally NOTIFY flickingHorizontallyChanged)
Q_PROPERTY(bool flickingVertically READ isFlickingVertically NOTIFY flickingVerticallyChanged)
Q_PROPERTY(FlickableDirection flickDirection READ flickDirection WRITE setFlickDirection NOTIFY flickableDirectionChanged) // deprecated
@@ -120,10 +120,10 @@ public:
qreal contentY() const;
void setContentY(qreal pos);
- bool isMoving() const; // deprecated
+ bool isMoving() const;
bool isMovingHorizontally() const;
bool isMovingVertically() const;
- bool isFlicking() const; // deprecated
+ bool isFlicking() const;
bool isFlickingHorizontally() const;
bool isFlickingVertically() const;
@@ -160,10 +160,10 @@ Q_SIGNALS:
void contentHeightChanged();
void contentXChanged();
void contentYChanged();
- void movingChanged(); // deprecated
+ void movingChanged();
void movingHorizontallyChanged();
void movingVerticallyChanged();
- void flickingChanged(); // deprecated
+ void flickingChanged();
void flickingHorizontallyChanged();
void flickingVerticallyChanged();
void horizontalVelocityChanged();
@@ -177,6 +177,10 @@ Q_SIGNALS:
void maximumFlickVelocityChanged();
void flickDecelerationChanged();
void pressDelayChanged();
+ void movementStarted();
+ void movementEnded();
+ void flickStarted();
+ void flickEnded();
protected:
virtual bool sceneEventFilter(QGraphicsItem *, QEvent *);
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 396acd0..fe78c84 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -347,8 +347,7 @@ public:
void QDeclarativeGridViewPrivate::init()
{
Q_Q(QDeclarativeGridView);
- QObject::connect(q, SIGNAL(movingHorizontallyChanged()), q, SLOT(animStopped()));
- QObject::connect(q, SIGNAL(movingVerticallyChanged()), q, SLOT(animStopped()));
+ QObject::connect(q, SIGNAL(movementEnded()), q, SLOT(animStopped()));
q->setFlag(QGraphicsItem::ItemIsFocusScope);
q->setFlickableDirection(QDeclarativeFlickable::VerticalFlick);
addItemChangeListener(this, Geometry);
@@ -878,13 +877,15 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this));
if (!flickingHorizontally && q->xflick()) {
flickingHorizontally = true;
- emit q->flickingChanged(); // deprecated
+ emit q->flickingChanged();
emit q->flickingHorizontallyChanged();
+ emit q->flickStarted();
}
if (!flickingVertically && q->yflick()) {
flickingVertically = true;
- emit q->flickingChanged(); // deprecated
+ emit q->flickingChanged();
emit q->flickingVerticallyChanged();
+ emit q->flickStarted();
}
} else {
timeline.reset(data.move);
@@ -2311,13 +2312,9 @@ void QDeclarativeGridView::destroyingItem(QDeclarativeItem *item)
void QDeclarativeGridView::animStopped()
{
Q_D(QDeclarativeGridView);
- if ((!d->movingVertically && d->flow == QDeclarativeGridView::LeftToRight)
- || (!d->movingHorizontally && d->flow == QDeclarativeGridView::TopToBottom))
- {
- d->bufferMode = QDeclarativeGridViewPrivate::NoBuffer;
- if (d->haveHighlightRange && d->highlightRange == QDeclarativeGridView::StrictlyEnforceRange)
- d->updateHighlight();
- }
+ d->bufferMode = QDeclarativeGridViewPrivate::NoBuffer;
+ if (d->haveHighlightRange && d->highlightRange == QDeclarativeGridView::StrictlyEnforceRange)
+ d->updateHighlight();
}
void QDeclarativeGridView::refill()
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 20106cb..46e9ce3 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -525,8 +525,7 @@ void QDeclarativeListViewPrivate::init()
Q_Q(QDeclarativeListView);
q->setFlag(QGraphicsItem::ItemIsFocusScope);
addItemChangeListener(this, Geometry);
- QObject::connect(q, SIGNAL(movingHorizontallyChanged()), q, SLOT(animStopped()));
- QObject::connect(q, SIGNAL(movingVerticallyChanged()), q, SLOT(animStopped()));
+ QObject::connect(q, SIGNAL(movementEnded()), q, SLOT(animStopped()));
q->setFlickableDirection(QDeclarativeFlickable::VerticalFlick);
::memset(sectionCache, 0, sizeof(QDeclarativeItem*) * sectionCacheSize);
}
@@ -1260,13 +1259,15 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this));
if (!flickingHorizontally && q->xflick()) {
flickingHorizontally = true;
- emit q->flickingChanged(); // deprecated
+ emit q->flickingChanged();
emit q->flickingHorizontallyChanged();
+ emit q->flickStarted();
}
if (!flickingVertically && q->yflick()) {
flickingVertically = true;
- emit q->flickingChanged(); // deprecated
+ emit q->flickingChanged();
emit q->flickingVerticallyChanged();
+ emit q->flickStarted();
}
correctFlick = true;
} else {
@@ -2890,12 +2891,9 @@ void QDeclarativeListView::destroyingItem(QDeclarativeItem *item)
void QDeclarativeListView::animStopped()
{
Q_D(QDeclarativeListView);
- if ((!d->movingVertically && d->orient == QDeclarativeListView::Vertical) || (!d->movingHorizontally && d->orient == QDeclarativeListView::Horizontal))
- {
- d->bufferMode = QDeclarativeListViewPrivate::NoBuffer;
- if (d->haveHighlightRange && d->highlightRange == QDeclarativeListView::StrictlyEnforceRange)
- d->updateHighlight();
- }
+ d->bufferMode = QDeclarativeListViewPrivate::NoBuffer;
+ if (d->haveHighlightRange && d->highlightRange == QDeclarativeListView::StrictlyEnforceRange)
+ d->updateHighlight();
}
QDeclarativeListViewAttached *QDeclarativeListView::qmlAttachedProperties(QObject *obj)