summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp37
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview_p.h5
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp49
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview_p.h10
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp29
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview_p.h5
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview_p_p.h4
7 files changed, 131 insertions, 8 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index e44a26d..283052a 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -106,6 +106,7 @@ public:
, highlightRangeStart(0), highlightRangeEnd(0), highlightRange(QDeclarativeGridView::NoHighlightRange)
, highlightComponent(0), highlight(0), trackedItem(0)
, moveReason(Other), buffer(0), highlightXAnimator(0), highlightYAnimator(0)
+ , highlightMoveDuration(150)
, bufferMode(NoBuffer), snapMode(QDeclarativeGridView::NoSnap)
, ownModel(false), wrap(false), autoHighlight(true)
, fixCurrentVisibility(false), lazyRelease(false), layoutScheduled(false)
@@ -327,6 +328,7 @@ public:
int buffer;
QSmoothedAnimation *highlightXAnimator;
QSmoothedAnimation *highlightYAnimator;
+ int highlightMoveDuration;
enum BufferMode { NoBuffer = 0x00, BufferBefore = 0x01, BufferAfter = 0x02 };
BufferMode bufferMode;
QDeclarativeGridView::SnapMode snapMode;
@@ -669,10 +671,10 @@ void QDeclarativeGridViewPrivate::createHighlight()
highlight = new FxGridItem(item, q);
highlightXAnimator = new QSmoothedAnimation(q);
highlightXAnimator->target = QDeclarativeProperty(highlight->item, QLatin1String("x"));
- highlightXAnimator->userDuration = 150;
+ highlightXAnimator->userDuration = highlightMoveDuration;
highlightYAnimator = new QSmoothedAnimation(q);
highlightYAnimator->target = QDeclarativeProperty(highlight->item, QLatin1String("y"));
- highlightYAnimator->userDuration = 150;
+ highlightYAnimator->userDuration = highlightMoveDuration;
highlightXAnimator->restart();
highlightYAnimator->restart();
changed = true;
@@ -1204,6 +1206,37 @@ void QDeclarativeGridView::setHighlightFollowsCurrentItem(bool autoHighlight)
}
/*!
+ \qmlproperty int GridView::highlightMoveDuration
+ This property holds the move animation duration of the highlight delegate.
+
+ highlightFollowsCurrentItem must be true for this property
+ to have effect.
+
+ The default value for the duration is 150ms.
+
+ \sa highlightFollowsCurrentItem
+*/
+int QDeclarativeGridView::highlightMoveDuration() const
+{
+ Q_D(const QDeclarativeGridView);
+ return d->highlightMoveDuration;
+}
+
+void QDeclarativeGridView::setHighlightMoveDuration(int duration)
+{
+ Q_D(QDeclarativeGridView);
+ if (d->highlightMoveDuration != duration) {
+ d->highlightMoveDuration = duration;
+ if (d->highlightYAnimator) {
+ d->highlightXAnimator->userDuration = d->highlightMoveDuration;
+ d->highlightYAnimator->userDuration = d->highlightMoveDuration;
+ }
+ emit highlightMoveDurationChanged();
+ }
+}
+
+
+/*!
\qmlproperty real GridView::preferredHighlightBegin
\qmlproperty real GridView::preferredHighlightEnd
\qmlproperty enumeration GridView::highlightRangeMode
diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h
index f73f632..5baa1dd 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h
@@ -66,6 +66,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeGridView : public QDeclarativeFlickable
Q_PROPERTY(QDeclarativeComponent *highlight READ highlight WRITE setHighlight NOTIFY highlightChanged)
Q_PROPERTY(QDeclarativeItem *highlightItem READ highlightItem NOTIFY highlightItemChanged)
Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem)
+ Q_PROPERTY(int highlightMoveDuration READ highlightMoveDuration WRITE setHighlightMoveDuration NOTIFY highlightMoveDurationChanged)
Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin NOTIFY preferredHighlightBeginChanged)
Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd NOTIFY preferredHighlightEndChanged)
@@ -106,6 +107,9 @@ public:
bool highlightFollowsCurrentItem() const;
void setHighlightFollowsCurrentItem(bool);
+ int highlightMoveDuration() const;
+ void setHighlightMoveDuration(int);
+
enum HighlightRangeMode { NoHighlightRange, ApplyRange, StrictlyEnforceRange };
HighlightRangeMode highlightRangeMode() const;
void setHighlightRangeMode(HighlightRangeMode mode);
@@ -161,6 +165,7 @@ Q_SIGNALS:
void preferredHighlightBeginChanged();
void preferredHighlightEndChanged();
void highlightRangeModeChanged();
+ void highlightMoveDurationChanged();
void modelChanged();
void delegateChanged();
void flowChanged();
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 31d97f3..b4506ef 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -156,7 +156,8 @@ public:
, highlightComponent(0), highlight(0), trackedItem(0)
, moveReason(Other), buffer(0), highlightPosAnimator(0), highlightSizeAnimator(0)
, sectionCriteria(0), spacing(0.0)
- , highlightMoveSpeed(400), highlightResizeSpeed(400), highlightRange(QDeclarativeListView::NoHighlightRange)
+ , highlightMoveSpeed(400), highlightMoveDuration(-1)
+ , highlightResizeSpeed(400), highlightResizeDuration(-1), highlightRange(QDeclarativeListView::NoHighlightRange)
, snapMode(QDeclarativeListView::NoSnap), overshootDist(0.0)
, footerComponent(0), footer(0), headerComponent(0), header(0)
, bufferMode(NoBuffer)
@@ -464,7 +465,9 @@ public:
QDeclarativeItem *sectionCache[sectionCacheSize];
qreal spacing;
qreal highlightMoveSpeed;
+ int highlightMoveDuration;
qreal highlightResizeSpeed;
+ int highlightResizeDuration;
QDeclarativeListView::HighlightRangeMode highlightRange;
QDeclarativeListView::SnapMode snapMode;
qreal overshootDist;
@@ -835,10 +838,12 @@ void QDeclarativeListViewPrivate::createHighlight()
highlightPosAnimator = new QSmoothedAnimation(q);
highlightPosAnimator->target = QDeclarativeProperty(highlight->item, posProp);
highlightPosAnimator->velocity = highlightMoveSpeed;
+ highlightPosAnimator->userDuration = highlightMoveDuration;
highlightPosAnimator->restart();
const QLatin1String sizeProp(orient == QDeclarativeListView::Vertical ? "height" : "width");
highlightSizeAnimator = new QSmoothedAnimation(q);
highlightSizeAnimator->velocity = highlightResizeSpeed;
+ highlightSizeAnimator->userDuration = highlightResizeDuration;
highlightSizeAnimator->target = QDeclarativeProperty(highlight->item, sizeProp);
highlightSizeAnimator->restart();
changed = true;
@@ -1867,13 +1872,19 @@ QString QDeclarativeListView::currentSection() const
/*!
\qmlproperty real ListView::highlightMoveSpeed
+ \qmlproperty int ListView::highlightMoveDuration
\qmlproperty real ListView::highlightResizeSpeed
+ \qmlproperty int ListView::highlightResizeDuration
These properties hold the move and resize animation speed of the highlight delegate.
highlightFollowsCurrentItem must be true for these properties
to have effect.
- The default value for these properties is 400 pixels/second.
+ The default value for the speed properties is 400 pixels/second.
+ The default value for the duration properties is -1, i.e. the
+ highlight will take as much time as necessary to move at the set speed.
+
+ These properties have the same characteristics as a SmoothedAnimation.
\sa highlightFollowsCurrentItem
*/
@@ -1894,6 +1905,23 @@ void QDeclarativeListView::setHighlightMoveSpeed(qreal speed)
}
}
+int QDeclarativeListView::highlightMoveDuration() const
+{
+ Q_D(const QDeclarativeListView);
+ return d->highlightMoveDuration;
+}
+
+void QDeclarativeListView::setHighlightMoveDuration(int duration)
+{
+ Q_D(QDeclarativeListView);\
+ if (d->highlightMoveDuration != duration) {
+ d->highlightMoveDuration = duration;
+ if (d->highlightPosAnimator)
+ d->highlightPosAnimator->userDuration = d->highlightMoveDuration;
+ emit highlightMoveDurationChanged();
+ }
+}
+
qreal QDeclarativeListView::highlightResizeSpeed() const
{
Q_D(const QDeclarativeListView);\
@@ -1911,6 +1939,23 @@ void QDeclarativeListView::setHighlightResizeSpeed(qreal speed)
}
}
+int QDeclarativeListView::highlightResizeDuration() const
+{
+ Q_D(const QDeclarativeListView);
+ return d->highlightResizeDuration;
+}
+
+void QDeclarativeListView::setHighlightResizeDuration(int duration)
+{
+ Q_D(QDeclarativeListView);\
+ if (d->highlightResizeDuration != duration) {
+ d->highlightResizeDuration = duration;
+ if (d->highlightSizeAnimator)
+ d->highlightSizeAnimator->userDuration = d->highlightResizeDuration;
+ emit highlightResizeDurationChanged();
+ }
+}
+
/*!
\qmlproperty enumeration ListView::snapMode
diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h
index 5810979..9c0b7dd 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h
@@ -101,7 +101,9 @@ class Q_DECLARATIVE_EXPORT QDeclarativeListView : public QDeclarativeFlickable
Q_PROPERTY(QDeclarativeItem *highlightItem READ highlightItem NOTIFY highlightItemChanged)
Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem NOTIFY highlightFollowsCurrentItemChanged)
Q_PROPERTY(qreal highlightMoveSpeed READ highlightMoveSpeed WRITE setHighlightMoveSpeed NOTIFY highlightMoveSpeedChanged)
+ Q_PROPERTY(int highlightMoveDuration READ highlightMoveDuration WRITE setHighlightMoveDuration NOTIFY highlightMoveDurationChanged)
Q_PROPERTY(qreal highlightResizeSpeed READ highlightResizeSpeed WRITE setHighlightResizeSpeed NOTIFY highlightResizeSpeedChanged)
+ Q_PROPERTY(int highlightResizeDuration READ highlightResizeDuration WRITE setHighlightResizeDuration NOTIFY highlightResizeDurationChanged)
Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin NOTIFY preferredHighlightBeginChanged)
Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd NOTIFY preferredHighlightEndChanged)
@@ -176,9 +178,15 @@ public:
qreal highlightMoveSpeed() const;
void setHighlightMoveSpeed(qreal);
+ int highlightMoveDuration() const;
+ void setHighlightMoveDuration(int);
+
qreal highlightResizeSpeed() const;
void setHighlightResizeSpeed(qreal);
+ int highlightResizeDuration() const;
+ void setHighlightResizeDuration(int);
+
enum SnapMode { NoSnap, SnapToItem, SnapOneItem };
SnapMode snapMode() const;
void setSnapMode(SnapMode mode);
@@ -208,7 +216,9 @@ Q_SIGNALS:
void currentIndexChanged();
void currentSectionChanged();
void highlightMoveSpeedChanged();
+ void highlightMoveDurationChanged();
void highlightResizeSpeedChanged();
+ void highlightResizeDurationChanged();
void highlightChanged();
void highlightItemChanged();
void modelChanged();
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index 813b525..5fcac49 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -221,7 +221,7 @@ void QDeclarativePathViewPrivate::updateHighlight()
tl.reset(moveHighlight);
moveHighlight.setValue(highlightPosition);
- const int duration = 300;
+ const int duration = highlightMoveDuration;
if (target - highlightPosition > model->count()/2) {
highlightUp = false;
@@ -691,6 +691,31 @@ void QDeclarativePathView::setHighlightRangeMode(HighlightRangeMode mode)
emit highlightRangeModeChanged();
}
+
+/*!
+ \qmlproperty int PathView::highlightMoveDuration
+ This property holds the move animation duration of the highlight delegate.
+
+ If the highlightRangeMode is StrictlyEnforceRange then this property
+ determines the speed that the items move along the path.
+
+ The default value for the duration is 300ms.
+*/
+int QDeclarativePathView::highlightMoveDuration() const
+{
+ Q_D(const QDeclarativePathView);
+ return d->highlightMoveDuration;
+}
+
+void QDeclarativePathView::setHighlightMoveDuration(int duration)
+{
+ Q_D(QDeclarativePathView);
+ if (d->highlightMoveDuration == duration)
+ return;
+ d->highlightMoveDuration = duration;
+ emit highlightMoveDurationChanged();
+}
+
/*!
\qmlproperty real PathView::dragMargin
This property holds the maximum distance from the path that initiate mouse dragging.
@@ -1316,7 +1341,7 @@ void QDeclarativePathViewPrivate::snapToCurrent()
tl.reset(moveOffset);
moveOffset.setValue(offset);
- const int duration = 300;
+ const int duration = highlightMoveDuration;
if (targetOffset - offset > model->count()/2) {
qreal distance = model->count() - targetOffset + offset;
diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p.h
index 69770cd..7240578 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepathview_p.h
@@ -68,6 +68,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativePathView : public QDeclarativeItem
Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin NOTIFY preferredHighlightBeginChanged)
Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd NOTIFY preferredHighlightEndChanged)
Q_PROPERTY(HighlightRangeMode highlightRangeMode READ highlightRangeMode WRITE setHighlightRangeMode NOTIFY highlightRangeModeChanged)
+ Q_PROPERTY(int highlightMoveDuration READ highlightMoveDuration WRITE setHighlightMoveDuration NOTIFY highlightMoveDurationChanged)
Q_PROPERTY(qreal dragMargin READ dragMargin WRITE setDragMargin NOTIFY dragMarginChanged)
Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration NOTIFY flickDecelerationChanged)
@@ -109,6 +110,9 @@ public:
qreal preferredHighlightEnd() const;
void setPreferredHighlightEnd(qreal);
+ int highlightMoveDuration() const;
+ void setHighlightMoveDuration(int);
+
qreal dragMargin() const;
void setDragMargin(qreal margin);
@@ -145,6 +149,7 @@ Q_SIGNALS:
void interactiveChanged();
void highlightChanged();
void highlightItemChanged();
+ void highlightMoveDurationChanged();
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
index 11712fd..303486f 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
@@ -85,7 +85,7 @@ public:
, highlightPosition(0)
, highlightRangeStart(0), highlightRangeEnd(0)
, highlightRangeMode(QDeclarativePathView::StrictlyEnforceRange)
- , highlightMoveSpeed(1.0)
+ , highlightMoveDuration(300)
{
}
@@ -160,7 +160,7 @@ public:
qreal highlightRangeStart;
qreal highlightRangeEnd;
QDeclarativePathView::HighlightRangeMode highlightRangeMode;
- qreal highlightMoveSpeed;
+ int highlightMoveDuration;
};
QT_END_NAMESPACE