Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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: myFont.name, // 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 ?

    Thanks


Log in to reply