Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
None
-
5.15.11
Description
import QtQuick 2.15 import QtQuick.Controls 2.15 ApplicationWindow { width: 640 height: 480 visible: true readonly property int n: 10 Tumbler { id: tumbler wrap: false currentIndex: n-2 model: n } Component.onCompleted: console.log("Current index is", tumbler.currentIndex) }
Expected output
qml: Current index is 8
Actual output
qml: Current index is 7
Problem scope
- The issue persists even if we change the value of n
- The issue does not occur if tumbler.wrap == true
- The issue does not occur if the initial value of tumbler.currentIndex != n-2
- The issue does not occur with Qt 6.2.6 and 6.4.0
Workaround
Instead of setting currentIndex declaratively, assign the desired value in the Component.onCompleted signal handler of the parent window:
Component.onCompleted: tumbler.currentIndex = n-2
This workaround must be applied to the parent window, not to the Tumbler itself.
Attachments
Issue Links
- duplicates
-
QTBUG-102793 [REG: 5.13->5.14] Bindings in delegates get triggered multiple times if delegate and/or model is changed
-
- Closed
-
For Gerrit Dashboard: QTBUG-107732 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
409729,3 | Avoid double applyDelegateChange in QQIV::setDelegate | tqtc/lts-5.15 | qt/tqtc-qtdeclarative | Status: MERGED | +2 | 0 |