Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

The order of property initialization of a QML component

$
0
0
Hi onek24, Thanks for your reply. But how the profiler can tell you the sequence of creation? Check the timeline? By the way , I found a dirty hack to fix my problem: A widget: property TextInputStyle style : Style.theme.textInput That is my original code. “Style” is a singleton object shared by all widget to provide the default style information. But it will complains “Cannot set properties on style as it is null” in the main.qml for setting custom style for the instance. This piece of code fix the problem:     property TextInputStyle style : TextInputStyle {         background: Style.theme.textInput.background         textStyle: TextStyle {             textSize: Style.theme.textInput.textStyle.textSize             textColor: Style.theme.textInput.textStyle.textColor         }         textSelectHandle: Style.theme.textInput.textSelectHandle  } I guess one of the factor to determine the order is the “depth” of component. Nested component will go first. And simple variable assignment will go later.

Viewing all articles
Browse latest Browse all 4972

Trending Articles