[Qt-qml] Why can't I stylesheet a font?
Jason H
scorp1us at yahoo.com
Tue Jul 13 06:37:48 CEST 2010
Actually I like Gregory's better still. While I'd likely put the "style sheet"
stuff in a separate file, your implementation implies that I'd have to have a
file for every item of every style. HTML CSS's files can be one per site, and
that's a huge feature.
And the fact that I can specify font and color (which isn't a part of font!?)
at the same time is really handy.
Still, good to know...
----- Original Message ----
From: Alan Alpert <alan.alpert at nokia.com>
To: qt-qml at trolltech.com
Sent: Tue, July 13, 2010 12:30:37 AM
Subject: Re: [Qt-qml] Why can't I stylesheet a font?
On Tue, 13 Jul 2010 10:48:46 ext Gregory Schlomoff wrote:
> I second that. Would be very useful to be able to create a predefined
> group of properties, and then assign the group as a whole to any
> object.
>
> Something like this:
>
> PropertyGroup {
> id:bigText
> font.face = "Arial"
> font.pointSize: 30
> color: "red"
> }
>
> Text {
> text:"Hello"
> properties: [bigText, anotherSetOfProperties]
> }
Something also like that, but that you can do in QML today, is:
MyText.qml
Text{
font.face: "Arial"
font.pointSize: 20
color: "red"
}
main.qml
MyText{
text: "Hello"
}
This approach has the advantage of being linked to the type. This means that
you only use the properties relevant for that type. Also the precedence is
clear, so if you want to set a different color but keep the other properties,
that's easy and should be unambiguous.
The downside of this approach is that you need an extra file, but presumably if
these properties are worthwhile separating out you may want to use them in
multiple files anyways.
--
Alan Alpert
Software Engineer
Nokia, Qt Development Frameworks
_______________________________________________
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