Font property styling
-
Hi
I would make something like this:
@
Item
{
id: rootQtObject { id:style property font mainFont:{ family: "Times"; pointSize: 42; capitalization: Font.AllUppercase } } Text { font: style.mainFont }
}
@
but I've got error in line 7
it's not possible create property with font type.Are there any solution for this situation?
-
May be I am wrong but I think you should use font-family instead of family.
Hope you get it
-
As a matter of fact, try this
property font mainFont:{ font-family: "Times"; font-size: 42px; font-variant: small-caps }
-
Unfortunately the above isn't really possible at the moment. Some alternatives are:
- Be explicit with each property. (Text { font.family: style.family; font.pointSize: style.pointSize ... })
- Created a styled, reusable Text element (See e.g. "Styling in QML":http://developer.qt.nokia.com/wiki/QmlStyling)
-
You'll need to set the individual font properties like font.family, font.pointSize etc. instead of just setting 'font'.
You may be interested in this: "http://developer.qt.nokia.com/wiki/QmlStyling":http://developer.qt.nokia.com/wiki/QmlStyling