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. Beginner problems with QML and glyphs

Beginner problems with QML and glyphs

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 58 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.
  • ? Offline
    ? Offline
    A Former User
    wrote last edited by A Former User
    #1

    Hi,

    I'm new to QT. At the moment I'm playing around for testing with qml and i encountered a strange problem:
    I started to use the material fonts as icons.

    For this i added the Font in cpp:
    QFontDatabase::addApplicationFont(":/Ressources/MaterialSymbolsOutlined.ttf");

    then i try to use it in QML:
    ToolButton {
    font.family: "MaterialSymbolsOutlined"
    font.pixelSize: 24
    text: "\ue900"
    }

    here i get a totaly wrong icon displayed, while "\ue8ff" as example works just well.

    Do you have got any idea what i'm doing wrong here?

    Thanks

    Edit:
    • Which Qt version are you using? QT 6.10.1
    • Which version of QtCreator are you using? 18.01
    • Which platform? Windows 11
    • How did you install it? Installer

    1 Reply Last reply
    0
    • GrecKoG Offline
      GrecKoG Offline
      GrecKo
      Qt Champions 2018
      wrote last edited by
      #2

      I would recommend using icons as .svg instead of iconfonts
      Buttons support icon themes : https://doc.qt.io/qt-6/qtquickcontrols-icons.html .
      Write an icon.theme file pointing to a folder with your icons then you could do the following in your code:

      ToolButton {
          icon.name: "zoom_out"
      }
      
      1 Reply Last reply
      1
      • ? Offline
        ? Offline
        A Former User
        wrote last edited by
        #3

        Thank you,
        I will take look at it.

        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