Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.9.3
-
None
-
Windows 10, MSVC 2017 64bit
-
4624ec51b2f1672b109dfec536230f3920bdbd36
Description
running this:
import QtQuick 2.9 import QtQuick.Window 2.2 import QtQuick.Controls 2.2 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") property int setting: 4 Row { Button { text: "click" onClicked: setting++ } Tumbler { model: { console.log("updating model to:", setting); return setting; } onModelChanged: { var newIdx = model -2; console.log("updating currentIndex to", newIdx, model); currentIndex = newIdx; console.log("currentIndex was updated to:", currentIndex); } onCurrentIndexChanged: console.log("currentIndex changed to:", currentIndex) } } }
and clicking the button a few times results in the following log:
qml: updating model to: 4 qml: updating currentIndex to 2 4 qml: currentIndex was updated to: -1 qml: currentIndex changed to: 2 qml: currentIndex changed to: 0 qml: currentIndex changed to: 2 qml: updating model to: 5 qml: updating currentIndex to 3 5 qml: currentIndex changed to: 3 qml: currentIndex was updated to: 3 qml: currentIndex changed to: 0 qml: updating model to: 6 qml: updating currentIndex to 4 6 qml: currentIndex changed to: 4 qml: currentIndex was updated to: 4 qml: currentIndex changed to: 0
as you see in the log the index that was set manually is overwritten to 0 afterwards.
except for the first case where the index update was ignored at first, but suddenly the index changes to the right one, set to zero and to the right index again.
this behaviour is really strange and makes some implementations really difficult or impossible.