Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. font properties overriden
Qt 6.11 is out! See what's new in the release blog

font properties overriden

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 279 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ebatsin
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved