I have a widget specified through a QML file. This widget contains a top levelRectangle
which contains two Columns
. Each of these Columns
In Qt 5.6 (at least, probably earlier too), you can use Qt.font()
to dynamically allocate a font object and refer to it elsewhere. So, this works:
property font myFont: Qt.font({
family: fontfamily,
bold: fontbold,
italic: fontitalic,
pixelSize: fontpixelsize
});
Text
{
color: fontcolor
font: parent.myFont
}
More info on Qt.font()
here: https://doc-snapshots.qt.io/qt5-5.6/qml-qtqml-qt.html#font-method