Unsolved QML Styling - what is happening in the back
-
Re: Defining custom colors in qml
I'm using the same approach to define item positioning in screen (which is described in QML documentation QML Styling)
However, I'm a little concerned about what is happening in the back of my code.As an example, let say this is my code:
// Style.qml pragma Singleton import QtQuick 2.0 QtObject { readonly property int posx: 20 readonly property int posy: 10 } // qmldir singleton Style 1.0 Style.qml // in use import QtQuick 2.0 import "." Text { x: Style.posx y: Style.posy text: "Hello World" }
My expectation is that this will behave as const int or #define in C. Basically, the constant value will be replaced at compilation time by the compiler and no binding will be created.
I have a feeling this is not actually the case, and I would like to understand what is really happening and if there is a way to achieve a behavior similar to what I'm expecting.