From 34767778f6409f414add562eaad0eac11d88149d Mon Sep 17 00:00:00 2001 From: Karim Pinter Date: Thu, 15 Oct 2015 15:39:05 +0000 Subject: 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 --- src/extras/Tumbler.qml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/extras/Tumbler.qml') 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; }); } -- cgit v1.2.1