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. Problem with two fontloader in singleton
Forum Update on Monday, May 27th 2025

Problem with two fontloader in singleton

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 596 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.
  • M Offline
    M Offline
    msauer75
    wrote on last edited by
    #1

    Hi,

    I want to use two different fonts in my QML project. In my singleton I defined the two fontloaders:

        readonly property FontLoader fontAwesomeSolid: FontLoader {
            source: "qrc:/assets/fa-solid-900.otf"
        }
        readonly property FontLoader fontAwesomeRegular: FontLoader {
                source: "qrc:/assets/fa-regular-400.otf"
        }
    
        readonly property string regular: fontAwesomeRegular.name
        readonly property string solid: fontAwesomeSolid.name
    

    The system will only use the fonts from fa-regular-400.otf. So the icons are wrong.

    In my navigation bar I want to use icons from fa-solid-900.otf:

            Row {
                Text {
                    id: textIcon
                    width: Style.widthNavigationButtonIcon
                    height: Style.heightNavigationButtonIcon
                    font {
                        family: Style.solid
                        pixelSize: Style.pixelSizeNavigationBarIcon
                    }
                    color: Style.colourNavigationBarFont
                    text: "\uf11a"
                    verticalAlignment: Text.AlignVCenter
                    horizontalAlignment: Text.AlignHCenter
                }
                Text {
                    id: textDescription
                    width: Style.widthNavigationButtonDescription
                    height: Style.heightNavigationButtonDescription
                    color: Style.colourNavigationBarFont
                    text: "SET ME!!"
                    verticalAlignment: Text.AlignVCenter
                    font.pixelSize: Style.pixelSizeNavigationBarText
                }
            }
    

    But It will only use the icons from fa-regular-400.otf.
    What have I to do that I can use more than one custom fonts?

    Thank you for your help.
    BR
    martin

    1 Reply Last reply
    0
    • M Offline
      M Offline
      msauer75
      wrote on last edited by
      #2

      Ok. I found the problem. The solution is here: https://github.com/FortAwesome/Font-Awesome/issues/12787

      BR
      martin

      1 Reply Last reply
      2

      • Login

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