diff options
author | Karim Pinter <karim.pinter@theqtcompany.com> | 2015-10-15 15:39:05 +0000 |
---|---|---|
committer | Karim Pinter <karim.pinter@theqtcompany.com> | 2015-10-22 09:41:30 +0000 |
commit | 34767778f6409f414add562eaad0eac11d88149d (patch) | |
tree | 092e16a42ee60f845f35224cb6045b3495f9893a /src/extras/Tumbler.qml | |
parent | d7f141944aee1e9d5a264168ea2d1d917a1e24b8 (diff) | |
download | qtquickcontrols-34767778f6409f414add562eaad0eac11d88149d.tar.gz |
Adding animation interval for tumbler
Extending the Tumblers setCurrentIndexAt method with timeinterval, which
is set to the animation so while it changes it can move slower then
default.
Task-number: QTBUG-48680
Change-Id: Ic8e76c604bad928ae7b11cfbea76c11d5d295f80
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/extras/Tumbler.qml')
-rw-r--r-- | src/extras/Tumbler.qml | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/extras/Tumbler.qml b/src/extras/Tumbler.qml index 7cba6ed0..47cb043c 100644 --- a/src/extras/Tumbler.qml +++ b/src/extras/Tumbler.qml @@ -177,20 +177,19 @@ Control { } /*! - \qmlmethod void Tumbler::setCurrentIndexAt(int columnIndex, int itemIndex) - Sets the current index of the column at \a columnIndex to \a itemIndex. + \qmlmethod void Tumbler::setCurrentIndexAt(int columnIndex, int itemIndex, int interval) + Sets the current index of the column at \a columnIndex to \a itemIndex. The animation + length can be set with \a interval, which defaults to \c 0. Does nothing if \a columnIndex or \a itemIndex are invalid. */ - function setCurrentIndexAt(columnIndex, itemIndex) { + function setCurrentIndexAt(columnIndex, itemIndex, interval) { if (!__isValidColumnAndItemIndex(columnIndex, itemIndex)) return; var view = columnRepeater.itemAt(columnIndex).view; if (view.currentIndex !== itemIndex) { - // Hack to work around the pathview jumping when the index is changed. - // TODO: doesn't seem to be necessary anymore? - view.highlightMoveDuration = 0; + view.highlightMoveDuration = typeof interval !== 'undefined' ? interval : 0; view.currentIndex = itemIndex; view.highlightMoveDuration = Qt.binding(function(){ return __highlightMoveDuration; }); } |