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. QT5.5 scaling high definition screens
Forum Updated to NodeBB v4.3 + New Features

QT5.5 scaling high definition screens

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 1.7k 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.
  • O Offline
    O Offline
    OlliW
    wrote on last edited by
    #1

    Hey folks
    using PyQT5/QT5.5, I wrote - as my first attempt with QT - a little app which runs fine on Win7, but on my Win8 laptop with a high-def screen the main window as well as some widgets are way too small (on the laptop I've set windows scaling to 200%). For composing the gui I use Qt Designer 5.5.0. I've read the docs multiple times as well as scanned the web, but I don't get it.
    The issue seems to happen whenever there are explicit size values specified in QtDesigner, e.g. for getting a shorter Button than what the layout would normally do, or the MainWindow's size geometry. These seem to be interpreted as px and are not scaled when running.
    I also have issues when I do my own painting, the painted objects are positioned incorrectly, obviously because I specify their position using e.g. move() with numbers.

    How would I set Widget sizes in QTDesigner, and draw paintings, in a way that they would render fine on both the normal and high-def screen?

    As mentioned, from the docs I didn't got it, sorry if the answer would be obvious.
    THX, Olli

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      You can find here information about High DPI handling

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • O Offline
        O Offline
        OlliW
        wrote on last edited by
        #3

        many thanks for the response
        this page I know very well but unfortunately I can't extract any useful info, in terms of e.g. actual code, from it. E.g. how could I, using the QtDesigner, ensure that all widgets are using the qreal QPainter and replace all hardcoded sizes by something derived from some other metrics? Adding this in by hand for all widgets looks very daunting to me, and somewhat brute force, I would think that there should be a smarter way.

        (e.g. I would have thought that all given pixel sizes are device independent pixels and thus scaled by Qt/OS, but that seems not to be the case).

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Aren't you using layouts for your widgets ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • O Offline
            O Offline
            OlliW
            wrote on last edited by
            #5

            yes, I do use layouts, but I'm not sure it's of relevance
            e.g., as said, the size of the main window itself at startup - for which in my understanding there is no layout since its the root widget of everything - is also displayed too small on a high-def screen!
            the main window size I think is determined by the size in QtDesigner, and then coded into the ui file (or derived py file). On normal screens the window is sized as expected, on high-def screens it is also sized correctly in terms of pixel numbers, but here that's not what one wants as it's then way to small
            So, how could one get the main window to be sized appropriately?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Did you start your application with QT_DEVICE_PIXEL_RATIO set to two ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              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