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
Forum Updated to NodeBB v4.3 + New Features

Font changes not aplying

Scheduled Pinned Locked Moved Solved General and Desktop
fonteglfs rpi2raspberry pi 2
16 Posts 3 Posters 6.6k 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.
  • S SGaist
    27 Mar 2016, 00:10

    Did you check the returned id from addApplicationFont ?

    C Offline
    C Offline
    cxam
    wrote on 27 Mar 2016, 12:11 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 27 Mar 2016, 20:38 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

      C 1 Reply Last reply 27 Mar 2016, 21:26
      0
      • S SGaist
        27 Mar 2016, 20:38

        What is the value of id ?

        C Offline
        C Offline
        cxam
        wrote on 27 Mar 2016, 21:26 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
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 27 Mar 2016, 21:46 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

          C 1 Reply Last reply 28 Mar 2016, 10:15
          0
          • S SGaist
            27 Mar 2016, 21:46

            Use the debugger then or a dummy widget.

            C Offline
            C Offline
            cxam
            wrote on 28 Mar 2016, 10:15 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
            • M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 28 Mar 2016, 10:30 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
              ?

              C 2 Replies Last reply 28 Mar 2016, 10:58
              1
              • M mrjj
                28 Mar 2016, 10:30

                @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
                ?

                C Offline
                C Offline
                cxam
                wrote on 28 Mar 2016, 10:58 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
                • M mrjj
                  28 Mar 2016, 10:30

                  @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
                  ?

                  C Offline
                  C Offline
                  cxam
                  wrote on 28 Mar 2016, 11:06 last edited by
                  #14

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

                  Stay Hungry, Stay Foolish

                  M 1 Reply Last reply 28 Mar 2016, 11:07
                  0
                  • C cxam
                    28 Mar 2016, 11:06

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

                    M Offline
                    M Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 28 Mar 2016, 11:07 last edited by
                    #15

                    @cxam
                    so did it make any difference?

                    C 1 Reply Last reply 28 Mar 2016, 11:16
                    0
                    • M mrjj
                      28 Mar 2016, 11:07

                      @cxam
                      so did it make any difference?

                      C Offline
                      C Offline
                      cxam
                      wrote on 28 Mar 2016, 11:16 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

                      16/16

                      28 Mar 2016, 11:16

                      • Login

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