summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorChristiaan Janssen <christiaan.janssen@nokia.com>2009-10-06 10:00:22 (GMT)
committerChristiaan Janssen <christiaan.janssen@nokia.com>2009-10-06 10:04:08 (GMT)
commit396a06a52a0f00639c9e528caf80ae2294e80bd2 (patch)
tree8e25a703390c74ec9078ac01ae874ad6bc0700b0 /src/declarative
parent2d7ad6196158a6138c946a5d26eefe9ac32f0773 (diff)
downloadQt-396a06a52a0f00639c9e528caf80ae2294e80bd2.zip
Qt-396a06a52a0f00639c9e528caf80ae2294e80bd2.tar.gz
Qt-396a06a52a0f00639c9e528caf80ae2294e80bd2.tar.bz2
Added properties highlightMoveSpeed and highlightResizeSpeed (ListView)
The speed of the moving and resizing animations of the highlight component were hardcoded, now they are accessible through these new properties. Reviewed-by: thartman
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/fx/qfxlistview.cpp49
-rw-r--r--src/declarative/fx/qfxlistview.h11
2 files changed, 58 insertions, 2 deletions
diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp
index 501b4df..1247021 100644
--- a/src/declarative/fx/qfxlistview.cpp
+++ b/src/declarative/fx/qfxlistview.cpp
@@ -178,6 +178,7 @@ public:
, moveReason(Other), buffer(0), highlightPosAnimator(0), highlightSizeAnimator(0), spacing(0.0)
, ownModel(false), wrap(false), autoHighlight(true)
, haveHighlightRange(false), strictHighlightRange(false)
+ , highlightMoveSpeed(400), highlightResizeSpeed(400)
{}
void init();
@@ -390,6 +391,8 @@ public:
QString sectionExpression;
QString currentSection;
qreal spacing;
+ qreal highlightMoveSpeed;
+ qreal highlightResizeSpeed;
bool ownModel : 1;
bool wrap : 1;
@@ -667,11 +670,11 @@ void QFxListViewPrivate::createHighlight()
const QLatin1String posProp(orient == Qt::Vertical ? "y" : "x");
highlightPosAnimator = new QmlEaseFollow(q);
highlightPosAnimator->setTarget(QmlMetaProperty(highlight->item, posProp));
- highlightPosAnimator->setVelocity(400);
+ highlightPosAnimator->setVelocity(highlightMoveSpeed);
highlightPosAnimator->setEnabled(autoHighlight);
const QLatin1String sizeProp(orient == Qt::Vertical ? "height" : "width");
highlightSizeAnimator = new QmlEaseFollow(q);
- highlightSizeAnimator->setVelocity(400);
+ highlightSizeAnimator->setVelocity(highlightResizeSpeed);
highlightSizeAnimator->setTarget(QmlMetaProperty(highlight->item, sizeProp));
highlightSizeAnimator->setEnabled(autoHighlight);
}
@@ -1259,6 +1262,48 @@ QString QFxListView::currentSection() const
return d->currentSection;
}
+/*!
+ \qmlproperty real ListView::highlightMoveSpeed
+
+ This property holds the moving animation speed of the highlight delegate.
+*/
+qreal QFxListView::highlightMoveSpeed() const
+{
+ Q_D(const QFxListView);\
+ return d->highlightMoveSpeed;
+}
+
+void QFxListView::setHighlightMoveSpeed(qreal speed)
+{
+ Q_D(QFxListView);\
+ if (d->highlightMoveSpeed != speed)
+ {
+ d->highlightMoveSpeed = speed;
+ emit highlightMoveSpeedChanged();
+ }
+}
+
+/*!
+ \qmlproperty real ListView::highlightResizeSpeed
+
+ This property holds the resizing animation speed of the highlight delegate.
+*/
+qreal QFxListView::highlightResizeSpeed() const
+{
+ Q_D(const QFxListView);\
+ return d->highlightResizeSpeed;
+}
+
+void QFxListView::setHighlightResizeSpeed(qreal speed)
+{
+ Q_D(QFxListView);\
+ if (d->highlightResizeSpeed != speed)
+ {
+ d->highlightResizeSpeed = speed;
+ emit highlightResizeSpeedChanged();
+ }
+}
+
void QFxListView::viewportMoved()
{
Q_D(QFxListView);
diff --git a/src/declarative/fx/qfxlistview.h b/src/declarative/fx/qfxlistview.h
index fc15967..3cff422 100644
--- a/src/declarative/fx/qfxlistview.h
+++ b/src/declarative/fx/qfxlistview.h
@@ -77,6 +77,9 @@ class Q_DECLARATIVE_EXPORT QFxListView : public QFxFlickable
Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer)
Q_PROPERTY(QString sectionExpression READ sectionExpression WRITE setSectionExpression NOTIFY sectionExpressionChanged)
Q_PROPERTY(QString currentSection READ currentSection NOTIFY currentSectionChanged)
+
+ Q_PROPERTY(qreal highlightMoveSpeed READ highlightMoveSpeed WRITE setHighlightMoveSpeed NOTIFY highlightMoveSpeedChanged)
+ Q_PROPERTY(qreal highlightResizeSpeed READ highlightResizeSpeed WRITE setHighlightResizeSpeed NOTIFY highlightResizeSpeedChanged)
Q_CLASSINFO("DefaultProperty", "data")
public:
@@ -126,6 +129,12 @@ public:
void setSectionExpression(const QString &);
QString currentSection() const;
+ qreal highlightMoveSpeed() const;
+ void setHighlightMoveSpeed(qreal);
+
+ qreal highlightResizeSpeed() const;
+ void setHighlightResizeSpeed(qreal);
+
static QFxListViewAttached *qmlAttachedProperties(QObject *);
public Q_SLOTS:
@@ -138,6 +147,8 @@ Q_SIGNALS:
void currentIndexChanged();
void currentSectionChanged();
void sectionExpressionChanged();
+ void highlightMoveSpeedChanged();
+ void highlightResizeSpeedChanged();
protected:
virtual void viewportMoved();