Important: Please read the Qt Code of Conduct -

font properties overriden

  • Hi!

    I have a custom Text component that I use for all the texts in my application :

    import QtQuick 2.12
    import MyTheme 1.0
    Text {
        font: Theme.fonts.defaultFont
        color: Theme.colors.defaultTextColor
        renderType: OsInfo.isWindow ? Text.NativeRendering : Text.QtRendering

    Theme.fonts.defaultFont is defined as follow:

    property font defaultFont: Qt.font({
        bold: false,
        family:, // a font loaded somewhere else in the file
        pointSize: 10

    I am requesting a specific font family, but if I do the following :

    MyCustomText {
        text: `Some text`
        font.pointSize: 15

    The font properties are reverted (the font family defined in MyCustomText seems to go back to the default value with a point size of 15. If I do not modify the font's point size, the right font family is used

    Any idea on what causes this and if there is a workaround ?


Log in to reply