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. HighDPI support and scaling
QtWS25 Last Chance

HighDPI support and scaling

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 755 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.
  • J Offline
    J Offline
    JohnGa
    wrote on last edited by JohnGa
    #1

    Hello,
    To handle multiple monitors with different resolutions, I setting the following setting as per documentation:

    QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    

    I have 4K laptop screen, and a 4K external monitor. Both of them are running at the same resolution. I think the PPI is different for the two monitors.

    With the HighDpiScaling enabled, when I move my application from the external monitor to the laptop screen, all the fonts (in the dock widgets, menu bar, etc.) appear much bigger.

    Conversely, when I move the application launched on the laptop screen first, to the external monitor the fonts are too small. All the controls like status bar, menu bar, slider thickness, etc. also vary similarly.

    I have the exact same problem with QtCreator also. What am I doing wrong? How do I solve this problem?

    Laptop Screen:
    0_1553362050629_Laptop-Screen.PNG

    External Monitor:
    0_1553362063812_External-Monitor.PNG

    Thanks.

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

      Hi
      For your app, step one would be to hook up to
      https://doc.qt.io/qt-5/qwindow.html#screenChanged
      and check devicePixelRatio() if it does indeed change.

      J 1 Reply Last reply
      1
      • mrjjM mrjj

        Hi
        For your app, step one would be to hook up to
        https://doc.qt.io/qt-5/qwindow.html#screenChanged
        and check devicePixelRatio() if it does indeed change.

        J Offline
        J Offline
        JohnGa
        wrote on last edited by
        #3

        @mrjj Thanks for the tip. Once I hook up to this notification, what should I do to set the appropriate scaling (I am thinking this is what needs to happen). The notes about logical DPI, etc. is very confusing and I can't seem to fix this issue.

        mrjjM 1 Reply Last reply
        0
        • J JohnGa

          @mrjj Thanks for the tip. Once I hook up to this notification, what should I do to set the appropriate scaling (I am thinking this is what needs to happen). The notes about logical DPI, etc. is very confusing and I can't seem to fix this issue.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @JohnGa
          Hi
          Looking at the docs
          https://doc.qt.io/qt-5/highdpi.html#migration-of-existing-applications
          It seems you can set scaling pr screen.
          "The format can be either a semicolon-separated list of scale factors in the same order as QGuiApplication::screens(), or a semicolon-separated list of name=value pairs, where name is the same as QScreen::name()."

          so if you inspected QScreen::name() you could have a scaling pr screen. via QT_SCREEN_SCALE_FACTORS
          Im not sure that the best or the only way.
          Maybe others have easier/better solution.

          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