Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Some trouble with high DPI
Forum Updated to NodeBB v4.3 + New Features

Some trouble with high DPI

Scheduled Pinned Locked Moved Solved QML and Qt Quick
high dpimulti-screenresolutiongeometryborderless wind
2 Posts 1 Posters 914 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.
  • jeanmilostJ Offline
    jeanmilostJ Offline
    jeanmilost
    wrote on last edited by
    #1

    Using Qt 5.15.2, I created a Qt Quick 2.0 application. The app is contained in a borderless non-resizeable window, and is planned to support the high DPI features. However I have some trouble, especially when I have several monitors with different DPI settings.

    There are several situations.

    1 - I open my borderless window onto a 120 dpi monitor:
    borderless_120dpi.png

    Then I move it onto a 96 dpi monitor:
    borderless_96dpi.png

    As you can see, the window size changes, but its content isn't resized

    2- I add a frame to my window, and I open it onto a 120 dpi monitor:
    framed_120dpi.png

    Now I move it onto a 96 dpi monitor:
    framed_96dpi.png

    Then I move it back to the 120 dpi monitor:
    framed_120dpi_again.png

    This time, the content is resized too large in relation to my window.

    I also get strange logs I cannot figure out, like the following:
    QWindowsWindow::setGeometry: Unable to set geometry 400x728+3574+161 (frame: 416x767+3566+130) on CommandListForm_QMLTYPE_194/"" on "\.\DISPLAY1". Resulting geometry: 504x920+3574+161 (frame: 520x959+3566+130) margins: 8, 31, 8, 8) - qwindowswindow.cpp:1891, void __cdecl QWindowsWindow::setGeometry(const class QRect &)

    As Qt is supposed to support high DPI features, what am I doing wrong?

    NOTE below is the window code for the first situation:

        // common properties
        id: awMainForm
        objectName: "awMainForm"
        width: 602
        height: 728
        minimumWidth: 602
        minimumHeight: 728
        maximumWidth: 602
        maximumHeight: 728
        flags: (Qt.Window | Qt.FramelessWindowHint)
        visible: true
    

    and for the second:

        // common properties
        id: awMainForm
        objectName: "awMainForm"
        width: 602
        height: 728
        minimumWidth: 602
        minimumHeight: 728
        maximumWidth: 602
        maximumHeight: 728
        flags: Qt.Window
        visible: true
    
    1 Reply Last reply
    0
    • jeanmilostJ Offline
      jeanmilostJ Offline
      jeanmilost
      wrote on last edited by jeanmilost
      #2

      I finally found a solution which seems to work in my case. I added the Qt.MSWindowsFixedSizeDialogHint window flag, which seems to fix the issue.

      So below is the modified code:

      ApplicationWindow
      {
          // common properties
          id: awMainForm
          width: 602
          height: 728
          flags: Qt.Window | Qt.FramelessWindowHint | Qt.MSWindowsFixedSizeDialogHint
          visible: true
      
          // form content isn't relevant
          ...
      }
      
      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