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. How to set different fonts according to different OSes?
Qt 6.11 is out! See what's new in the release blog

How to set different fonts according to different OSes?

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 4 Posters 1.4k 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.
  • Christian EhrlicherC Online
    Christian EhrlicherC Online
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on last edited by
    #4

    If you don't see a specific font in the ui file then the font from the parent (and in the last resort this is QApplication) will be used. So don't set a font in the ui file and use QApplication::setFont() if you want a custom font instead the one provided by the OS.

    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
    Visit the Qt Academy at https://academy.qt.io/catalog

    jronaldJ 1 Reply Last reply
    0
    • jronaldJ jronald

      e.g.
      For Linux, noto might be a good default choice, for Windows, Tahoma might be.
      As in a .ui file, a widget and its children could have different fonts.
      Is it necessary to change the font of every widget that has property font?

      S Offline
      S Offline
      stretchthebits
      wrote on last edited by
      #5

      @jronald Isn't that something that you should let your users choose?
      Have a font dialog box open and let the user choose what he wants.

      jronaldJ 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        If you don't see a specific font in the ui file then the font from the parent (and in the last resort this is QApplication) will be used. So don't set a font in the ui file and use QApplication::setFont() if you want a custom font instead the one provided by the OS.

        jronaldJ Offline
        jronaldJ Offline
        jronald
        wrote on last edited by jronald
        #6

        @Christian-Ehrlicher said in How to set different fonts according to different OSes?:

        If you don't see a specific font in the ui file then the font from the parent (and in the last resort this is QApplication) will be used. So don't set a font in the ui file and use QApplication::setFont() if you want a custom font instead the one provided by the OS.

        Thank you, but with a newly created application, the font is already there, and no way to remove it.

        Christian EhrlicherC 1 Reply Last reply
        0
        • S stretchthebits

          @jronald Isn't that something that you should let your users choose?
          Have a font dialog box open and let the user choose what he wants.

          jronaldJ Offline
          jronaldJ Offline
          jronald
          wrote on last edited by
          #7

          @stretchthebits said in How to set different fonts according to different OSes?:

          Isn't that something that you should let your users choose?
          Have a font dialog box open and let the user choose what he wants.

          Yes, but good default settings are better, a lot of users are used to default values.

          1 Reply Last reply
          0
          • jronaldJ jronald

            @Christian-Ehrlicher said in How to set different fonts according to different OSes?:

            If you don't see a specific font in the ui file then the font from the parent (and in the last resort this is QApplication) will be used. So don't set a font in the ui file and use QApplication::setFont() if you want a custom font instead the one provided by the OS.

            Thank you, but with a newly created application, the font is already there, and no way to remove it.

            Christian EhrlicherC Online
            Christian EhrlicherC Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #8

            @jronald said in How to set different fonts according to different OSes?:

            the font is already there, and no way to remove it.

            I don't understand what you want to tell us - what's the problem setting a new font with QApplication::setFont()?

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            jronaldJ 1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              @jronald said in How to set different fonts according to different OSes?:

              the font is already there, and no way to remove it.

              I don't understand what you want to tell us - what's the problem setting a new font with QApplication::setFont()?

              jronaldJ Offline
              jronaldJ Offline
              jronald
              wrote on last edited by
              #9

              @Christian-Ehrlicher said in How to set different fonts according to different OSes?:

              If you don't see a specific font in the ui file then the font from the parent (and in the last resort this is QApplication) will be used. So don't set a font in the ui file and use QApplication::setFont() if you want a custom font instead the one provided by the OS.

              @Christian-Ehrlicher said in How to set different fonts according to different OSes?:

              I don't understand what you want to tell us - what's the problem setting a new font with QApplication::setFont()?

              I mean I'd like that there is no specific font in the ui file, but there is always one.
              QApplication::setFont() should work, it'll be better if there is no specific font in the ui file, any way?

              JonBJ Christian EhrlicherC 2 Replies Last reply
              0
              • jronaldJ jronald

                @Christian-Ehrlicher said in How to set different fonts according to different OSes?:

                If you don't see a specific font in the ui file then the font from the parent (and in the last resort this is QApplication) will be used. So don't set a font in the ui file and use QApplication::setFont() if you want a custom font instead the one provided by the OS.

                @Christian-Ehrlicher said in How to set different fonts according to different OSes?:

                I don't understand what you want to tell us - what's the problem setting a new font with QApplication::setFont()?

                I mean I'd like that there is no specific font in the ui file, but there is always one.
                QApplication::setFont() should work, it'll be better if there is no specific font in the ui file, any way?

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

                @jronald said in How to set different fonts according to different OSes?:

                it'll be better if there is no specific font in the ui file

                I have a feeling that quite a while ago there was a thread in this forum discussing this issue. I may (well) be mistaken, but I thought it was decided it was a "bug" that Designer put any explicit font in for you if you did not choose one yourself. Is that your case? I thought that might have altered in some later version of Qt/Designer, but you would have to track down the thread....

                Christian EhrlicherC 1 Reply Last reply
                0
                • JonBJ JonB

                  @jronald said in How to set different fonts according to different OSes?:

                  it'll be better if there is no specific font in the ui file

                  I have a feeling that quite a while ago there was a thread in this forum discussing this issue. I may (well) be mistaken, but I thought it was decided it was a "bug" that Designer put any explicit font in for you if you did not choose one yourself. Is that your case? I thought that might have altered in some later version of Qt/Designer, but you would have to track down the thread....

                  Christian EhrlicherC Online
                  Christian EhrlicherC Online
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #11

                  @JonB The bug removed something, did not set a font: https://forum.qt.io/topic/134040/

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  JonBJ 1 Reply Last reply
                  2
                  • jronaldJ jronald

                    @Christian-Ehrlicher said in How to set different fonts according to different OSes?:

                    If you don't see a specific font in the ui file then the font from the parent (and in the last resort this is QApplication) will be used. So don't set a font in the ui file and use QApplication::setFont() if you want a custom font instead the one provided by the OS.

                    @Christian-Ehrlicher said in How to set different fonts according to different OSes?:

                    I don't understand what you want to tell us - what's the problem setting a new font with QApplication::setFont()?

                    I mean I'd like that there is no specific font in the ui file, but there is always one.
                    QApplication::setFont() should work, it'll be better if there is no specific font in the ui file, any way?

                    Christian EhrlicherC Online
                    Christian EhrlicherC Online
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #12

                    @jronald said in How to set different fonts according to different OSes?:

                    I mean I'd like that there is no specific font in the ui file, but there is always one.

                    No, there is not as long as you don't explicitly set one. It just shows you the current defaults as in every other setting you're seeing there and is not bold.

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    1 Reply Last reply
                    2
                    • Christian EhrlicherC Christian Ehrlicher

                      @JonB The bug removed something, did not set a font: https://forum.qt.io/topic/134040/

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

                      @Christian-Ehrlicher said in How to set different fonts according to different OSes?:

                      @JonB The bug removed something, did not set a font: https://forum.qt.io/topic/134040/

                      Prefect, that was the one! Seems that was indeed the other way round from this post :)

                      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