[Qt-qml] Order of property initialization and assignments
mathias.malmqvist at nokia.com
mathias.malmqvist at nokia.com
Tue Nov 2 17:58:00 CET 2010
Hi,
Need some help understanding why my code doesn't work.
See http://qt.gitorious.org/~mathiasm/qt-components/mathiasm-qt-components/blobs/upstream-custom/LineEdit.qml
(apologies if by the time you look at the code the line numbers have changed)
On line 12 I define an alias for the font of the TextInput element defined on line 36. The intention is to allow the user of the LineEdit element to set things like font size and whether the font is bold or italic or not.
On lines 39 and 40 I set some defaults for the fonts pixelSize and boldness. The defaults are fetched from the styling element instantiated on line 18 and defined here
http://qt.gitorious.org/~mathiasm/qt-components/mathiasm-qt-components/blobs/upstream-custom/styles/default/LineEditStyle.qml
On line 48 here
http://qt.gitorious.org/~mathiasm/qt-components/mathiasm-qt-components/blobs/upstream-custom/Gallery.qml
we create a LineEdit instance and set the font to italic and 40 pixels size.
Now running the Gallery.qml file the text show italic, but not in the size we set (but rather the default size). This is probably because we didn't set a default for whether the font is italic or not, but set a default for the pixel size.
So; what's going on? Is this a problem to do with the rules for the order in which properties are initialization and overridden? What are those rules, and can I control them to get the behavior I want?
Cheers
Mathias
More information about the Qt-qml
mailing list