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. Text size changes accordingly to the computer settings
QtWS25 Last Chance

Text size changes accordingly to the computer settings

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 5 Posters 4.1k 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.
  • TelergoelT Offline
    TelergoelT Offline
    Telergoel
    wrote on last edited by
    #1

    Good evening,

    I finished a Qt program that works perfectly on my computer ; however when I tested it on someone else's, I noticed that all the texts displayed were too big for the widgets that contain them...
    This is caused by the settings on this person's computer (running on Windows 10), which had been parameterized in order to display text at 150% of its normal size (because the screen is smaller and displays everything smaller than usual).

    Therefore, I've thought about two different solutions to my issue :

    • prevent the size of the texts from adapting accordingly to the computer settings (in which case it may be difficult to read on screens like the one I talked about)
    • adapt all the widgets to the size of the text they contain, without having two widgets overflow on each other

    Which solution would be the easier one? I have no idea how to proceed.
    Thank you,

    Telergoel

    jsulmJ raven-worxR 2 Replies Last reply
    0
    • TelergoelT Telergoel

      Good evening,

      I finished a Qt program that works perfectly on my computer ; however when I tested it on someone else's, I noticed that all the texts displayed were too big for the widgets that contain them...
      This is caused by the settings on this person's computer (running on Windows 10), which had been parameterized in order to display text at 150% of its normal size (because the screen is smaller and displays everything smaller than usual).

      Therefore, I've thought about two different solutions to my issue :

      • prevent the size of the texts from adapting accordingly to the computer settings (in which case it may be difficult to read on screens like the one I talked about)
      • adapt all the widgets to the size of the text they contain, without having two widgets overflow on each other

      Which solution would be the easier one? I have no idea how to proceed.
      Thank you,

      Telergoel

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

      @Telergoel Do you use layouts in your Qt program? If so then the widgets should adjust their size so the content fits.

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

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Asperamanca
        wrote on last edited by
        #3

        There are use cases where it's important that the output looks the same on all computers. In this case, you can use the pixelSize in fonts.
        However, for most cases, the better approach is to have an UI that adapts to the changing font size, e.g. using layouts.

        1 Reply Last reply
        0
        • TelergoelT Telergoel

          Good evening,

          I finished a Qt program that works perfectly on my computer ; however when I tested it on someone else's, I noticed that all the texts displayed were too big for the widgets that contain them...
          This is caused by the settings on this person's computer (running on Windows 10), which had been parameterized in order to display text at 150% of its normal size (because the screen is smaller and displays everything smaller than usual).

          Therefore, I've thought about two different solutions to my issue :

          • prevent the size of the texts from adapting accordingly to the computer settings (in which case it may be difficult to read on screens like the one I talked about)
          • adapt all the widgets to the size of the text they contain, without having two widgets overflow on each other

          Which solution would be the easier one? I have no idea how to proceed.
          Thank you,

          Telergoel

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by raven-worx
          #4

          @Telergoel
          about what kind of widgets are we talking here?
          I am asking because normally the font-size should be already considered in the widget's sizeHint.
          Also i am not awaye (yet) of an event notifier for such a system change.

          I guess it only applies for the dpi scaling during rendering the font/text?
          So probably the text rendering engine takes some system properties to do the rendering.

          Read this and give the dpi-awareness (set to "0" i guess) approach a try.
          Or try setting the Qt::AA_DisableHighDpiScalingapplication attribute.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • TelergoelT Offline
            TelergoelT Offline
            Telergoel
            wrote on last edited by Telergoel
            #5

            Hello,
            sorry for answering late, I've been working on other things since then.

            I already use layouts. You have to understand that if I change the font size in Qt Creator, the widgets will adapt automatically ; they just won't if the text size is changed from the OS settings (I only tried on Windows, but I guess it would be the same on Linux or Mac).

            The widgets I'm talking about are labels, buttons, or even tabs of a QTabWidget (basically any widget that contains text is affected). The problem seems to happen on any computer if I change the text size in Windows settings.

            Here are screenshots showing the displayed window when setting the text size at 125% first, 100% then (on Windows 8): http://imgur.com/a/NHtHe

            Telergoel

            M 1 Reply Last reply
            0
            • TelergoelT Telergoel

              Hello,
              sorry for answering late, I've been working on other things since then.

              I already use layouts. You have to understand that if I change the font size in Qt Creator, the widgets will adapt automatically ; they just won't if the text size is changed from the OS settings (I only tried on Windows, but I guess it would be the same on Linux or Mac).

              The widgets I'm talking about are labels, buttons, or even tabs of a QTabWidget (basically any widget that contains text is affected). The problem seems to happen on any computer if I change the text size in Windows settings.

              Here are screenshots showing the displayed window when setting the text size at 125% first, 100% then (on Windows 8): http://imgur.com/a/NHtHe

              Telergoel

              M Offline
              M Offline
              Matheus
              wrote on last edited by
              #6

              @Telergoel Any answer to this?

              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