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. [SOLVED] problems with fonts and scaling
QtWS25 Last Chance

[SOLVED] problems with fonts and scaling

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 3.2k 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.
  • P Offline
    P Offline
    pmh4514
    wrote on last edited by
    #1

    [SOLUTION: Set Windows font-size to 100%]

    I am using Qt5.3.1 on Windows 8.1 only

    I have two laptops- the development PC and another one I'm testing my deploy on.

    Both laptops at 1920x1080 and under the "make text and other items larger or smaller" I have both set at the smallest setting.

    On my development PC where I've laid out my windows etc, everything looks proper.

    But on the deploy PC (which has same settings and same installed fonts) some of my windows are all crowded, with buttons, tabs, drop-down contents all crowded or overflowing.

    I tried adding this to main.cpp:
    @
    QFont newFont("Seqoe UI", 10, QFont:::Normal, false);
    QApplication::setFont(newFont)
    @

    Then, again, everything looks fine on DEV, with the new font displayed everywhere.. But again, on the deploy PC, I see the Segoe UI font is used, but again things are all crowded and overflowing.

    Most of the controls that are having problems are inside layouts.

    Any ideas how I can ensure a consistent look across Windows PCs or suggestions as to what I may have done wrong?

    Thanks!
    (ps. I've tried to put blank lines in my post here to make paragraphs for readability, but for some reason they seem to be stripped when I preview/submit)

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Are we talking about a QtQuick application, or a QtWidgets-based one?

      I suspect your layout definitions are wrong, you might have put size constrains on the widgets and that forces the layout to look as it does. What happens when you resize the window on your dev machine? Do you get any strange-looking layouts?

      And if it is about QtQuick: you can be more certain about things when you use PixelSize in fonts instead of PointSize.

      (Z(:^

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pmh4514
        wrote on last edited by
        #3

        QtWidgets

        The thing is, the window I made is a fixed size - it's a control panel for external hardware, not like a document editing app where somebody could open it to any size.

        I used layouts within the window where I could, some are custom layouts. Everything looks just fine on the dev PC.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          pmh4514
          wrote on last edited by
          #4

          edit: the particular layout of the controls seems to maintain consistency.. it is literally that the fonts are much larger on the deployment PC but I can't make sense of why.

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            Here is the thing, then: it's best to design and implement the UI as if it was intended to be resized. Once everything works fine and can be set to any size, you just call setFixedSize() on the top-level widget (or set it's minimumSize and maximumSize to the same value). If you do that, you can be almost certain that it will look good on any other machine.

            Your use-case looks a bit special (from your description), so I am not sure my hint applies there.

            (Z(:^

            1 Reply Last reply
            0
            • P Offline
              P Offline
              pmh4514
              wrote on last edited by
              #6

              I made a very simple single window app that does nothing but display some drop-down boxes and can be resized.. the font is still a different size on the deploy PC than it is on my development PC.

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

                You are sure that the DPI settings are the same?
                Try using setPixelSize on the font (just for testing, it shouldn't really be used for scalable UIs)

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  pmh4514
                  wrote on last edited by
                  #8

                  ahh yes.. it turns out in Win8.1 there is a difference between the "change the size of all items" and what you can do if you check "Let me choose one scaling level" - with that activated I saw that the "deploy laptop" was at 150% whereas Dev laptop was at 100%

                  When changed, they look consistent.

                  But of course that brings another thing for me to consider - handling when a user does choose something other than 100% for this setting.

                  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