Rename ListView *speed properties to *velocity
authorBea Lam <bea.lam@nokia.com>
Mon, 25 Jun 2012 03:05:15 +0000 (13:05 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 26 Jun 2012 06:08:37 +0000 (08:08 +0200)
Change-Id: I63c02d186b1832e7bf890a00caad150d5bf136cb
Reviewed-by: Martin Jones <martin.jones@nokia.com>
examples/demos/rssnews/rssnews.qml
src/quick/items/qquicklistview.cpp
src/quick/items/qquicklistview_p.h
tests/auto/quick/qquicklistview/data/displaylist.qml
tests/auto/quick/qquicklistview/data/flickBeyondBoundsBug.qml
tests/auto/quick/qquicklistview/data/listview-initCurrent.qml
tests/auto/quick/qquicklistview/data/listview-noCurrent.qml
tests/auto/quick/qquicklistview/data/listviewtest-package.qml
tests/auto/quick/qquicklistview/data/listviewtest.qml
tests/auto/quick/qquicklistview/tst_qquicklistview.cpp

index d26b94b..56960a5 100644 (file)
@@ -75,7 +75,7 @@ Rectangle {
                 footer: quitButtonDelegate
                 delegate: CategoryDelegate {}
                 highlight: Rectangle { color: "steelblue" }
-                highlightMoveSpeed: 9999999
+                highlightMoveVelocity: 9999999
             }
             ScrollBar {
                 scrollArea: categories; height: categories.height; width: 8
index d67e02e..f12da43 100644 (file)
@@ -144,8 +144,8 @@ public:
 
     QSmoothedAnimation *highlightPosAnimator;
     QSmoothedAnimation *highlightSizeAnimator;
-    qreal highlightMoveSpeed;
-    qreal highlightResizeSpeed;
+    qreal highlightMoveVelocity;
+    qreal highlightResizeVelocity;
     int highlightResizeDuration;
 
     QQuickViewSection *sectionCriteria;
@@ -169,7 +169,7 @@ public:
         , averageSize(100.0), spacing(0.0)
         , snapMode(QQuickListView::NoSnap)
         , highlightPosAnimator(0), highlightSizeAnimator(0)
-        , highlightMoveSpeed(400), highlightResizeSpeed(400), highlightResizeDuration(-1)
+        , highlightMoveVelocity(400), highlightResizeVelocity(400), highlightResizeDuration(-1)
         , sectionCriteria(0), currentSectionItem(0), nextSectionItem(0)
         , overshootDist(0.0), correctFlick(false), inFlickCorrection(false)
     {}
@@ -878,12 +878,12 @@ void QQuickListViewPrivate::createHighlight()
             const QLatin1String posProp(orient == QQuickListView::Vertical ? "y" : "x");
             highlightPosAnimator = new QSmoothedAnimation;
             highlightPosAnimator->target = QQmlProperty(item, posProp);
-            highlightPosAnimator->velocity = highlightMoveSpeed;
+            highlightPosAnimator->velocity = highlightMoveVelocity;
             highlightPosAnimator->userDuration = highlightMoveDuration;
 
             const QLatin1String sizeProp(orient == QQuickListView::Vertical ? "height" : "width");
             highlightSizeAnimator = new QSmoothedAnimation;
-            highlightSizeAnimator->velocity = highlightResizeSpeed;
+            highlightSizeAnimator->velocity = highlightResizeVelocity;
             highlightSizeAnimator->userDuration = highlightResizeDuration;
             highlightSizeAnimator->target = QQmlProperty(item, sizeProp);
 
@@ -1928,7 +1928,7 @@ QQuickListView::~QQuickListView()
     is scrolled.  This is because the view moves to maintain the
     highlight within the preferred highlight range (or visible viewport).
 
-    \sa highlight, highlightMoveSpeed
+    \sa highlight, highlightMoveVelocity
 */
 //###Possibly rename these properties, since they are very useful even without a highlight?
 /*!
@@ -2217,17 +2217,18 @@ QString QQuickListView::currentSection() const
 }
 
 /*!
-    \qmlproperty real QtQuick2::ListView::highlightMoveSpeed
+    \qmlproperty real QtQuick2::ListView::highlightMoveVelocity
     \qmlproperty int QtQuick2::ListView::highlightMoveDuration
-    \qmlproperty real QtQuick2::ListView::highlightResizeSpeed
+    \qmlproperty real QtQuick2::ListView::highlightResizeVelocity
     \qmlproperty int QtQuick2::ListView::highlightResizeDuration
 
-    These properties hold the move and resize animation speed of the highlight delegate.
+    These properties control the speed of the move and resize animations for the
+    highlight delegate.
 
     \l highlightFollowsCurrentItem must be true for these properties
     to have effect.
 
-    The default value for the speed properties is 400 pixels/second.
+    The default value for the velocity 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.
 
@@ -2235,20 +2236,20 @@ QString QQuickListView::currentSection() const
 
     \sa highlightFollowsCurrentItem
 */
-qreal QQuickListView::highlightMoveSpeed() const
+qreal QQuickListView::highlightMoveVelocity() const
 {
     Q_D(const QQuickListView);
-    return d->highlightMoveSpeed;
+    return d->highlightMoveVelocity;
 }
 
-void QQuickListView::setHighlightMoveSpeed(qreal speed)
+void QQuickListView::setHighlightMoveVelocity(qreal speed)
 {
     Q_D(QQuickListView);
-    if (d->highlightMoveSpeed != speed) {
-        d->highlightMoveSpeed = speed;
+    if (d->highlightMoveVelocity != speed) {
+        d->highlightMoveVelocity = speed;
         if (d->highlightPosAnimator)
-            d->highlightPosAnimator->velocity = d->highlightMoveSpeed;
-        emit highlightMoveSpeedChanged();
+            d->highlightPosAnimator->velocity = d->highlightMoveVelocity;
+        emit highlightMoveVelocityChanged();
     }
 }
 
@@ -2262,20 +2263,20 @@ void QQuickListView::setHighlightMoveDuration(int duration)
     }
 }
 
-qreal QQuickListView::highlightResizeSpeed() const
+qreal QQuickListView::highlightResizeVelocity() const
 {
     Q_D(const QQuickListView);
-    return d->highlightResizeSpeed;
+    return d->highlightResizeVelocity;
 }
 
-void QQuickListView::setHighlightResizeSpeed(qreal speed)
+void QQuickListView::setHighlightResizeVelocity(qreal speed)
 {
     Q_D(QQuickListView);
-    if (d->highlightResizeSpeed != speed) {
-        d->highlightResizeSpeed = speed;
+    if (d->highlightResizeVelocity != speed) {
+        d->highlightResizeVelocity = speed;
         if (d->highlightSizeAnimator)
-            d->highlightSizeAnimator->velocity = d->highlightResizeSpeed;
-        emit highlightResizeSpeedChanged();
+            d->highlightSizeAnimator->velocity = d->highlightResizeVelocity;
+        emit highlightResizeVelocityChanged();
     }
 }
 
index acedbdc..a40a01a 100644 (file)
@@ -102,10 +102,8 @@ class Q_AUTOTEST_EXPORT QQuickListView : public QQuickItemView
     Q_OBJECT
     Q_DECLARE_PRIVATE(QQuickListView)
 
-    // XXX deprecate these two properties (only duration should be necessary)
-    Q_PROPERTY(qreal highlightMoveSpeed READ highlightMoveSpeed WRITE setHighlightMoveSpeed NOTIFY highlightMoveSpeedChanged)
-    Q_PROPERTY(qreal highlightResizeSpeed READ highlightResizeSpeed WRITE setHighlightResizeSpeed NOTIFY highlightResizeSpeedChanged)
-
+    Q_PROPERTY(qreal highlightMoveVelocity READ highlightMoveVelocity WRITE setHighlightMoveVelocity NOTIFY highlightMoveVelocityChanged)
+    Q_PROPERTY(qreal highlightResizeVelocity READ highlightResizeVelocity WRITE setHighlightResizeVelocity NOTIFY highlightResizeVelocityChanged)
     Q_PROPERTY(int highlightResizeDuration READ highlightResizeDuration WRITE setHighlightResizeDuration NOTIFY highlightResizeDurationChanged)
 
     Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing NOTIFY spacingChanged)
@@ -136,11 +134,11 @@ public:
 
     virtual void setHighlightFollowsCurrentItem(bool);
 
-    qreal highlightMoveSpeed() const;
-    void setHighlightMoveSpeed(qreal);
+    qreal highlightMoveVelocity() const;
+    void setHighlightMoveVelocity(qreal);
 
-    qreal highlightResizeSpeed() const;
-    void setHighlightResizeSpeed(qreal);
+    qreal highlightResizeVelocity() const;
+    void setHighlightResizeVelocity(qreal);
 
     int highlightResizeDuration() const;
     void setHighlightResizeDuration(int);
@@ -161,8 +159,8 @@ Q_SIGNALS:
     void spacingChanged();
     void orientationChanged();
     void currentSectionChanged();
-    void highlightMoveSpeedChanged();
-    void highlightResizeSpeedChanged();
+    void highlightMoveVelocityChanged();
+    void highlightResizeVelocityChanged();
     void highlightResizeDurationChanged();
     void snapModeChanged();
 
index 4e8fd32..63c332b 100644 (file)
@@ -44,7 +44,7 @@ Rectangle {
         model: testModel
         delegate: myDelegate
         highlight: myHighlight
-        highlightMoveSpeed: 1000
-        highlightResizeSpeed: 1000
+        highlightMoveVelocity: 1000
+        highlightResizeVelocity: 1000
     }
 }
index 0a1b1a1..01b9ce3 100644 (file)
@@ -35,8 +35,8 @@ Rectangle {
         height: 320
         model: 2
         delegate: myDelegate
-        highlightMoveSpeed: 1000
-        highlightResizeSpeed: 1000
+        highlightMoveVelocity: 1000
+        highlightResizeVelocity: 1000
         cacheBuffer: 400
     }
     Text { anchors.bottom: parent.bottom; text: list.contentY }
index c4f1860..a02b66b 100644 (file)
@@ -56,7 +56,7 @@ Rectangle {
         height: 320
         keyNavigationWraps: testWrap
         delegate: myDelegate
-        highlightMoveSpeed: 1000
+        highlightMoveVelocity: 1000
         model: testModel
         header: root.showHeader ? headerFooter : null
         footer: root.showFooter ? headerFooter : null
index cb90300..fa7430c 100644 (file)
@@ -45,7 +45,7 @@ Rectangle {
         height: 320
         cacheBuffer: 0
         delegate: myDelegate
-        highlightMoveSpeed: 1000
+        highlightMoveVelocity: 1000
         model: testModel
     }
 }
index 54d4dab..14d2651 100644 (file)
@@ -136,8 +136,8 @@ Rectangle {
         height: 320
         model: visualModel.parts.package
         highlight: testObject.invalidHighlight ? invalidHl : myHighlight
-        highlightMoveSpeed: 1000
-        highlightResizeSpeed: 1000
+        highlightMoveVelocity: 1000
+        highlightResizeVelocity: 1000
         cacheBuffer: testObject.cacheBuffer
         header: root.showHeader ? headerFooter : null
         footer: root.showFooter ? headerFooter : null
index 47b341c..8da859f 100644 (file)
@@ -124,8 +124,8 @@ Rectangle {
         model: testModel
         delegate: testObject.animate ? animatedDelegate : myDelegate
         highlight: testObject.invalidHighlight ? invalidHl : myHighlight
-        highlightMoveSpeed: 1000
-        highlightResizeSpeed: 1000
+        highlightMoveVelocity: 1000
+        highlightResizeVelocity: 1000
         cacheBuffer: testObject.cacheBuffer
         header: root.showHeader ? headerFooter : null
         footer: root.showFooter ? headerFooter : null
index 848ffb1..7dba3a6 100644 (file)
@@ -419,8 +419,8 @@ void tst_QQuickListView::items(const QUrl &source, bool forceLayout)
     int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
     QTRY_VERIFY(itemCount == 0);
 
-    QTRY_COMPARE(listview->highlightResizeSpeed(), 1000.0);
-    QTRY_COMPARE(listview->highlightMoveSpeed(), 1000.0);
+    QTRY_COMPARE(listview->highlightResizeVelocity(), 1000.0);
+    QTRY_COMPARE(listview->highlightMoveVelocity(), 1000.0);
 
     delete canvas;
     delete testObject;