Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.2.0
-
None
-
Windows7 32-bit, most likely any platform.
-
ac39d220f2989286d871a16f064f4de69098f167
Description
If SpinBox has a value bound to a constant, it will emit onValueChanged with that value before the SpinBox is completed.
This can cause problems, since you cannot rely on that other items it depends on are constructed in the onValueChanged signal.
import QtQuick 2.1 import QtQuick.Controls 1.1 Rectangle { width: 300 height: 200 Item { SpinBox { value: 42 Component.onCompleted: console.log("SpinBox onCompleted, rect:" + rect); onValueChanged: { console.log("SpinBox onValueChanged: " + value + ", rect:" + rect); } } } Rectangle { id: rect } }
Shows
SpinBox onValueChanged: 42, rect:null(13):SpinBox onValueChanged: 42, rect:null SpinBox onCompleted, rect:QQuickRectangle(0x3f4e420)
Removing value: 42 will cause it to not emit onValueChanged