Important: Please read the Qt Code of Conduct -

Saving app's window position - on multiple monitors and scaled Windows 10

  • Hi,

    I am using Qt 5.14.0. If I have two monitors next to each other running Windows 10, both at 200% scaling, I get strange behavior with my application.

    A feature of my app is that it remembers the x and y coordinates of the application. This way, the next time the user opens it, it will appear at the same place. This works fine if I open the app on my main monitor, close it, and then reopen. It will appear at the exact same coordinates. However, if I instead move it to my second (non-main) monitor, close it there, and then reopen, the app will not open exactly where I closed it. Instead, the coordinates have been changed a little bit. In some cases this is enough for the application to open outside of the monitor, making it "invisible".

    A few examples:

    1. If main monitor is 100% and second is 175%
      Opening and closing on main monitor keeps the same x and y coordinates. However, opening and closing on second monitor changes x and y coordinates.
    1. If both main and second monitor are 175%
      Same result as above

    2. If both main and second monitor are 100%
      Works as intended. Opening and closing on either monitor keeps the same x and y coordinates.

    Has anyone encountered similar issues?

  • How are you restoring the values? Is that a Widgets or QML application?

  • I am using code very similar to this to restore the values.
    It is a QML application.

  • @mcleary any ideas why I might run into this problem?

  • Sorry for the late reply. I was hoping for you to say widgets, but I never tried this with QML so far. Unfortunately I don't have multiple monitor to test it myself at moment.

Log in to reply