Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Hi there,

Hi there,

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 365 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.
  • J Offline
    J Offline
    JackChiraque
    wrote on last edited by
    #1

    I'am a total beginner in QT, I'am trying to add a customized font that i can use in my GUI but i couldn't. Any help please? Note that i have already added the font to my Resources file but I don't know what to do next in order to use it.

    jsulmJ 1 Reply Last reply
    0
    • J JackChiraque

      I'am a total beginner in QT, I'am trying to add a customized font that i can use in my GUI but i couldn't. Any help please? Note that i have already added the font to my Resources file but I don't know what to do next in order to use it.

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @JackChiraque Take a look at https://forum.qt.io/topic/57772/using-custom-fonts

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      J 1 Reply Last reply
      2
      • jsulmJ jsulm

        @JackChiraque Take a look at https://forum.qt.io/topic/57772/using-custom-fonts

        J Offline
        J Offline
        JackChiraque
        wrote on last edited by JackChiraque
        #3

        @jsulm Thanks for your answer, it didn't work for me tho.
        I have already added the font to the resources file, but I don't know how to use for a QLabelText

        jsulmJ JonBJ 2 Replies Last reply
        0
        • J JackChiraque

          @jsulm Thanks for your answer, it didn't work for me tho.
          I have already added the font to the resources file, but I don't know how to use for a QLabelText

          jsulmJ Online
          jsulmJ Online
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @JackChiraque From the link I posted:

          int loadedFontID = QFontDatabase::addApplicationFont ( ":/Triforce.ttf" );
          QFont Triforce("Triforce", 24, QFont::Normal);
          ui->label->setFont(Triforce);
          

          Did you try that?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2
          • J JackChiraque

            @jsulm Thanks for your answer, it didn't work for me tho.
            I have already added the font to the resources file, but I don't know how to use for a QLabelText

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #5

            @JackChiraque
            Every QWidget, including QLabel, has QWidget:setFont(const QFont &). To read a font from resource file, Google for qfont from resource. there are several hits, maybe https://stackoverflow.com/questions/30973781/qt-add-custom-font-from-resource or https://forum.qt.io/topic/57772/using-custom-fonts.

            Then if you'd like to use the font via stylesheet instead of setFont(), see e.g. https://stackoverflow.com/questions/43411803/how-to-use-a-embedded-font-in-qt-style-sheet.

            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