diff options
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/fx/qfxlistview.cpp | 49 | ||||
-rw-r--r-- | src/declarative/fx/qfxlistview.h | 11 |
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(); |