diff options
-rw-r--r-- | examples/declarative/listview/itemlist.qml | 1 | ||||
-rw-r--r-- | src/declarative/fx/qfxflickable.cpp | 9 | ||||
-rw-r--r-- | src/declarative/fx/qfxflickable.h | 1 | ||||
-rw-r--r-- | src/declarative/fx/qfxgridview.cpp | 6 | ||||
-rw-r--r-- | src/declarative/fx/qfxlistview.cpp | 8 | ||||
-rw-r--r-- | src/declarative/qml/qmlprivate.h | 32 |
6 files changed, 21 insertions, 36 deletions
diff --git a/examples/declarative/listview/itemlist.qml b/examples/declarative/listview/itemlist.qml index 6ce4287..6392153 100644 --- a/examples/declarative/listview/itemlist.qml +++ b/examples/declarative/listview/itemlist.qml @@ -33,6 +33,7 @@ Rectangle { preferredHighlightEnd: 0 highlightRangeMode: "StrictlyEnforceRange" orientation: ListView.Horizontal + flickDeceleration: 2000 } Rectangle { diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index 659193d..0fb8474 100644 --- a/src/declarative/fx/qfxflickable.cpp +++ b/src/declarative/fx/qfxflickable.cpp @@ -889,6 +889,14 @@ void QFxFlickable::viewportMoved() } } +void QFxFlickable::cancelFlick() +{ + Q_D(QFxFlickable); + d->timeline.reset(d->_moveX); + d->timeline.reset(d->_moveY); + movementEnding(); +} + void QFxFlickablePrivate::data_removeAt(int) { // ### @@ -1257,6 +1265,7 @@ void QFxFlickable::movementEnding() emit flickEnded(); } d->horizontalVelocity.setValue(0); + d->verticalVelocity.setValue(0); } void QFxFlickablePrivate::updateVelocity() diff --git a/src/declarative/fx/qfxflickable.h b/src/declarative/fx/qfxflickable.h index 4c80e8f..3db4ca7 100644 --- a/src/declarative/fx/qfxflickable.h +++ b/src/declarative/fx/qfxflickable.h @@ -183,6 +183,7 @@ protected: bool xflick() const; bool yflick() const; + void cancelFlick(); protected: QFxFlickable(QFxFlickablePrivate &dd, QFxItem *parent); diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index 0b2a935..c07258d 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -857,10 +857,12 @@ int QFxGridView::currentIndex() const void QFxGridView::setCurrentIndex(int index) { Q_D(QFxGridView); - if (d->isValid() && index != d->currentIndex && index < d->model->count() && index >= 0) + if (d->isValid() && index != d->currentIndex && index < d->model->count() && index >= 0) { + cancelFlick(); d->updateCurrent(index); - else + } else { d->currentIndex = index; + } } QFxItem *QFxGridView::currentItem() diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 1f1b97b..15680e1 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -1172,10 +1172,12 @@ void QFxListView::setCurrentIndex(int index) { Q_D(QFxListView); d->moveReason = QFxListViewPrivate::Other; - if (d->isValid() && index != d->currentIndex && index < d->model->count() && index >= 0) + if (d->isValid() && index != d->currentIndex && index < d->model->count() && index >= 0) { + cancelFlick(); d->updateCurrent(index); - else + } else { d->currentIndex = index; + } } QFxItem *QFxListView::currentItem() @@ -1626,6 +1628,7 @@ void QFxListView::incrementCurrentIndex() Q_D(QFxListView); if (currentIndex() < d->model->count() - 1 || d->wrap) { int index = currentIndex()+1; + cancelFlick(); d->updateCurrent(index < d->model->count() ? index : 0); } } @@ -1641,6 +1644,7 @@ void QFxListView::decrementCurrentIndex() Q_D(QFxListView); if (currentIndex() > 0 || d->wrap) { int index = currentIndex()-1; + cancelFlick(); d->updateCurrent(index >= 0 ? index : d->model->count()-1); } } diff --git a/src/declarative/qml/qmlprivate.h b/src/declarative/qml/qmlprivate.h index 3e1a7e0..1b57f03 100644 --- a/src/declarative/qml/qmlprivate.h +++ b/src/declarative/qml/qmlprivate.h @@ -132,43 +132,11 @@ namespace QmlPrivate } }; -#if defined(Q_CC_MSVC) - template <typename T> - class has_attachedPropertiesMember - { - public: - __if_exists(T::qmlAttachedProperties) { - static bool const value = true; - } - __if_not_exists(T::qmlAttachedProperties) { - static bool const value = false; - } - }; -#elif defined(Q_OS_SYMBIAN) template <typename T> struct has_attachedPropertiesMember { static bool const value = QmlTypeInfo<T>::hasAttachedProperties; }; -#else - template <typename T> - class has_attachedPropertiesMember - { - typedef int yes_type; - typedef char no_type; - template <int> - struct Selector {}; - - template <typename S> - static yes_type test(Selector<sizeof(&S::qmlAttachedProperties)>*); - - template <typename S> - static no_type test(...); - - public: - static bool const value = sizeof(test<T>(0)) == sizeof(yes_type); - }; -#endif template <typename T, bool hasMember> class has_attachedPropertiesMethod |