diff options
author | Jens Bache-Wiig <jens.bache-wiig@digia.com> | 2014-04-07 18:03:24 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-08 12:18:03 +0200 |
commit | 442f12e628e7ad7aeaaeef1c9fa3e3498cb851e0 (patch) | |
tree | 337783e38925c773cec4ae4e53b575bf614d19e1 | |
parent | 953b8d7ed82f2701ba8f6f572e60468da544c5ec (diff) | |
download | qtquickcontrols-442f12e628e7ad7aeaaeef1c9fa3e3498cb851e0.tar.gz |
Fix initialization to non-zero TableView index
The bug was caused by trying to set the currentIndex of the
internal TabBar ListView higher than the model count which was
populated later. We can work around it by adding an extra check
on the model size.
[ChangeLog][QtQuickControls][TabView] Fixed a graphics issue when
initializing currentIndex to a non-zero value.
Task-number: QTBUG-38157
Change-Id: Ic0907bc41512f187b31c79d47515fb51b15c5f0e
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
-rw-r--r-- | src/controls/Private/TabBar.qml | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/controls/Private/TabBar.qml b/src/controls/Private/TabBar.qml index 29a40f3f..5e76df36 100644 --- a/src/controls/Private/TabBar.qml +++ b/src/controls/Private/TabBar.qml @@ -126,7 +126,10 @@ FocusScope { height: currentItem ? currentItem.height : 0 highlightMoveDuration: 0 - currentIndex: tabView.currentIndex + + // We cannot bind directly to the currentIndex because the actual model is + // populated after the listview is completed, resulting in an invalid contentItem + currentIndex: tabView.currentIndex < model.count ? tabView.currentIndex : -1 onCurrentIndexChanged: tabrow.positionViewAtIndex(currentIndex, ListView.Contain) moveDisplaced: Transition { |