Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.0.1, 6.1.0 RC
-
Windows 10 64-bit, using Qt 6.0.1, MSVC2019 64-bit and QtCreator 4.14.2 (Built on Mar 19 2021 09:03:03 From revision c34b950227)
Description
file:///C:/Qt/6.0.1/msvc2019_64/qml/QtQuick/Controls/Windows/Button.qml:77:49: Unable to assign [undefined] to int.
This warning comes up because in Button.qml at line 77 duration is set from the parent's transitionDuration, but the parent does not have one.
The warning is raised at runtime and happens if you hover over a button which does not set the transitionDuration manually before instantiating the object.
The parent at line 77 is Behaviour, but the intended parent is the Button in which the Behaviour is defined.
It should be either parent.parent.transitionDuration or an id can be set for the NativeStyle.Button which is used to guide to the intended parent and use that like so:
NativeStyle.Button {
id: exampleName
control: control
x: background.x
y: background.y
width: background.width
height: background.height
useNinePatchImage: false
overrideState: NativeStyle.StyleItem.AlwaysHovered
opacity: control.hovered ? 1 : 0
Behavior on opacity { NumberAnimation { duration: exampleName.transitionDuration }}
}