diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2021-01-14 14:19:26 +0100 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2021-01-14 15:50:10 +0000 |
commit | 1fe83c1fd3eb9abfd13a7b8c7adb2c2355d8ad4d (patch) | |
tree | 4fbaf751dca8b4ab3f1e5d82e67871f01ccb9055 /src | |
parent | 2f509278a12dc38c94801b03b8b43a090e21ada7 (diff) |
Fix initial currentIndex in Tumbler when wrap is set to false
syncCurrentIndex () function assumes that PathView is used as view for,
Tumbler component, and states that actualViewIndex should be 0 while
initialization. This statement is not correct when Tumbler is in
non-wrap mode and uses ListView as view, where currentIndex is set to
-1 by default. Fix actualViewIndex condition according to ListView
logic.
Fixes: QTBUG-84426
Pick-to: 5.15
Pick-to: 6.0
Change-Id: I4ef1e7b45399bf748968490f44b8909f3218d9bc
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quicktemplates2/qquicktumbler.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/quicktemplates2/qquicktumbler.cpp b/src/quicktemplates2/qquicktumbler.cpp index e8fbcbd5..5f17cd29 100644 --- a/src/quicktemplates2/qquicktumbler.cpp +++ b/src/quicktemplates2/qquicktumbler.cpp @@ -667,8 +667,9 @@ void QQuickTumblerPrivate::syncCurrentIndex() return; } - // PathView likes to use 0 as currentIndex for empty models, but we use -1 for that. - if (q->count() == 0 && actualViewIndex == 0) + // actualViewIndex might be 0 or -1 for PathView and ListView respectively, + // but we always use -1 for that. + if (q->count() == 0 && actualViewIndex <= 0) return; ignoreCurrentIndexChanges = true; |