[Qt-qml] Order of property initialization and assignments
Pekka.E.Jokela at nokia.com
Pekka.E.Jokela at nokia.com
Wed Nov 3 07:23:16 CET 2010
Hi,
This looks the same as:
http://bugreports.qt.nokia.com/browse/QTBUG-13719
-P
>-----Original Message-----
>From: qt-qml-bounces at trolltech.com [mailto:qt-qml-bounces at trolltech.com]
>On Behalf Of Malmqvist Mathias (Nokia-MS/London)
>Sent: 02.11.2010 19:36
>To: qt-qml at trolltech.com
>Subject: Re: [Qt-qml] Order of property initialization and assignments
>
>
>So apparently the problem is that the default values are taken from the
>styling element that is loaded dynamically,
>which means they get loaded and set at a point in time after the pixel
>size has been set in Gallery.qml, overwriting the value we wanted.
>
>Is there any way I can tell if a property has been explicitly assigned a
>value, and so not assign the default?
>Or is there an entirely better way of doing this?
>
>
>Cheers
>Mathias
>________________________________________
>From: qt-qml-bounces at trolltech.com [qt-qml-bounces at trolltech.com] On
>Behalf Of Malmqvist Mathias (Nokia-MS/London)
>Sent: Tuesday, November 02, 2010 4:58 PM
>To: qt-qml at trolltech.com
>Subject: [Qt-qml] Order of property initialization and assignments
>
>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
>
>_______________________________________________
>Qt-qml mailing list
>Qt-qml at trolltech.com
>http://lists.trolltech.com/mailman/listinfo/qt-qml
>
>_______________________________________________
>Qt-qml mailing list
>Qt-qml at trolltech.com
>http://lists.trolltech.com/mailman/listinfo/qt-qml
More information about the Qt-qml
mailing list