[Qt-qml] Some way to set default font attributes
warwick.allison at nokia.com
warwick.allison at nokia.com
Tue Apr 6 02:03:48 CEST 2010
> Is there a way to set default font attributes for the whole
> Qml(Context/Engine/View)?
The Text font defaults to the QApplication::font(), which defaults to the system font.
> I'm working on a mobile app and I had to set font family and size for
> every single text component I'm using, I could subclass them but that
> seems to be too much.
It's perfectly reasonable to "subclass" Text in QML. eg. you might make HeaderText.qml that is simply:
import Qt 4.7
Text { font.pixelSize: 20 }
It would be unusual for an application to use just one font and yet for that not to be the system default font. An application will more usually have a few different types of text and so have a couple of subclasses for those that are not the system font.
--
Warwick
More information about the Qt-qml
mailing list