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. Font changes not aplying

Font changes not aplying

Scheduled Pinned Locked Moved Solved General and Desktop
fonteglfs rpi2raspberry pi 2
16 Posts 3 Posters 7.9k Views 3 Watching
  • 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #6

    Did you check the returned id from addApplicationFont ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    cxamC 1 Reply Last reply
    0
    • SGaistS SGaist

      Did you check the returned id from addApplicationFont ?

      cxamC Offline
      cxamC Offline
      cxam
      wrote on last edited by
      #7

      @SGaist More or less, what I did to test that the font is working is this:

      int id = QFontDatabase::addApplicationFont( "/usr/share/fonts/truetype/Open_Sans/OpenSans-Regular.ttf");
      QString family = QFontDatabase::applicationFontFamilies(id).at(0);
      QFont monospace(family);
      qApp->setFont(monospace);
      

      But it doesn't work.... No idea what can be happening

      Stay Hungry, Stay Foolish

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #8

        What is the value of id ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        cxamC 1 Reply Last reply
        0
        • SGaistS SGaist

          What is the value of id ?

          cxamC Offline
          cxamC Offline
          cxam
          wrote on last edited by
          #9

          @SGaist I'm trying to show the value of the "id" variable through QDebug and the Application output but it's not showing.

          Stay Hungry, Stay Foolish

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #10

            Use the debugger then or a dummy widget.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            cxamC 1 Reply Last reply
            0
            • SGaistS SGaist

              Use the debugger then or a dummy widget.

              cxamC Offline
              cxamC Offline
              cxam
              wrote on last edited by
              #11

              @SGaist Ok, I wasn't pressing the "Debug" button haha, anyways I've found that the "id" value is 0.

              Stay Hungry, Stay Foolish

              1 Reply Last reply
              0
              • mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #12

                @cxam said:
                hi, just small question.
                Since addApplicationFont dont return -1 for error, i wonder if he need to NEW the font as they talk about here
                https://forum.qt.io/topic/23875/how-to-use-qfontdatabase-addapplicationfont
                ?

                cxamC 2 Replies Last reply
                1
                • mrjjM mrjj

                  @cxam said:
                  hi, just small question.
                  Since addApplicationFont dont return -1 for error, i wonder if he need to NEW the font as they talk about here
                  https://forum.qt.io/topic/23875/how-to-use-qfontdatabase-addapplicationfont
                  ?

                  cxamC Offline
                  cxamC Offline
                  cxam
                  wrote on last edited by
                  #13

                  @mrjj said:

                  https://forum.qt.io/topic/23875/how-to-use-qfontdatabase-addapplicationfont

                  I think that's the answer to my problem but I'm unable to put it into my program, would you mind making it more explained for me please?

                  Stay Hungry, Stay Foolish

                  1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @cxam said:
                    hi, just small question.
                    Since addApplicationFont dont return -1 for error, i wonder if he need to NEW the font as they talk about here
                    https://forum.qt.io/topic/23875/how-to-use-qfontdatabase-addapplicationfont
                    ?

                    cxamC Offline
                    cxamC Offline
                    cxam
                    wrote on last edited by
                    #14

                    @mrjj Ok, I've got it. Thank you for your help :)

                    Stay Hungry, Stay Foolish

                    mrjjM 1 Reply Last reply
                    0
                    • cxamC cxam

                      @mrjj Ok, I've got it. Thank you for your help :)

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #15

                      @cxam
                      so did it make any difference?

                      cxamC 1 Reply Last reply
                      0
                      • mrjjM mrjj

                        @cxam
                        so did it make any difference?

                        cxamC Offline
                        cxamC Offline
                        cxam
                        wrote on last edited by
                        #16

                        @mrjj Yes, What I did was

                        QFontDatabase::addApplicationFont("/usr/share/fonts/truetype/Open_Sans/OpenSans-Regular.ttf");
                        

                        and then select "Open Sans" on the QtDesigner

                        Stay Hungry, Stay Foolish

                        1 Reply Last reply
                        1

                        • Login

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