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

Font Size (DPI)

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 9.5k Views 1 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 Offline
    S Offline
    szh1
    wrote on last edited by
    #1

    I set my application's main window to a fixed size, by setting the minimum and maximum size the same. The only problem that I am worried about is if the user changes the font size / DPI in the control panel. Then, not all of the text fits on the window, and the text on the controls doesn't look centered. What should I do about this problem? My idea was to check the user's font size, and if it is not 100%, then set it to 100%, and when the application closes, set it back to the original value. Is there a way to do this in Qt? Or, is there a better solution?

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Franzk
      wrote on last edited by
      #2

      The better solution is obviously to make sure your application can be resized (use the layout system. It's extremely useful). Other options include scrollbars or auto-resizing as you suggest. In the latter case, I think you should look for changeEvent(), but I'm not entirely sure of that.

      "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • ? This user is from outside of this forum
        ? This user is from outside of this forum
        Guest
        wrote on last edited by
        #3

        [quote author="szh1" date="1288827273"]... The only problem that I am worried about is if the user changes the font size / DPI in the control panel. ... My idea was to check the user's font size, and if it is not 100%, ...[/quote]

        Which control panel are you referring to here?

        You are setting a fixed size to your main window, but allowing the user to change the font size. And if the user changes the font size, in that case, you again want to reset the font size to 100%? In that case why don't you set a fixed font size upfront and not allow the user to change it i the first place?

        I'd refer to how apps like MS Word handles this scenario ... the pages are fixed, the font sizes can be varied and implement the functionality in the same way.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          szh1
          wrote on last edited by
          #4

          I mean the Windows Control Panel under "Display". The user can change how big text is displayed in all applications that run on their system ("DPI"). The default is 100%, meaning "9 point Segoe UI at 96 pixels per inch."

          If the user increases the value, then I have a problem.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            szh1
            wrote on last edited by
            #5

            "You can find more about DPI here":http://en.wiktionary.org/wiki/dots_per_inch

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tobias.hunger
              wrote on last edited by
              #6

              I would keep the font size the user has set up and not mess with it. The user usually has some reason to make the fonts bigger, including bad eye sight, etc. You are going to make the application unusable for that user if you force the fonts back to a smaller size.

              The best solution is not to hard code the window size and to use layouts instead.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                szh1
                wrote on last edited by
                #7

                Okay, I guess I'll have to use layouts. Thanks for the help.

                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