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. Mac vs Windows scaling (same app much smaller on Windows)
Forum Updated to NodeBB v4.3 + New Features

Mac vs Windows scaling (same app much smaller on Windows)

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 1.4k 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.
  • jandymanJ Offline
    jandymanJ Offline
    jandyman
    wrote on last edited by jandyman
    #1

    I have to create a QML Python app that will look somewhat the same on Mac and Windows. But by default, my attempts yield results that are MUCH different in size (see picture).

    alt text

    I'm running both on the same physical screen, with Windows under Parallels, and my screen scaling is set up so that the user experience is similar between Mac and Windows for most other programs (including QT Creator itself). Yet the QML app is a massively different size.

    Why is this? And is there a way to set the global scaling of the QML to make the Windows version bigger (the Mac OS version looks basically "correct")? Any other approach I could think of to deal with this programmatically seems like it would be very messy, and probably prevent me from using QT designer at all, which would be a giant disappointment.

    1 Reply Last reply
    0
    • jandymanJ Offline
      jandymanJ Offline
      jandyman
      wrote on last edited by jandyman
      #2

      It turns out the solution to this is simple, though I had to read a whole bunch of confusing descriptions of scalability. It really should be easier to find. And the Qt support pages on the topic could be less confusing.

      https://stackoverflow.com/questions/41331201/pyqt-5-and-4k-screen

      Put this in your setup code before creating the QGuiApplication, to support High DPI scaling on Windows:

          os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
          sys.argv += ['--style', 'fusion']
          app = QGuiApplication(sys.argv)
      

      The font scaling ends up a little bit different, but that is acceptable for my use case.

      For C++ users, look here:

      https://doc.qt.io/qt-5/qtquickcontrols2-highdpi.html

      Whew! I was getting nervous about my decision to create this cross platform UI.

      1 Reply Last reply
      1

      • Login

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