View Full Version : Application Window Lost When Moving from 2 Screens to 1

14th October 2015, 14:13

I have an application with a single window.

When I run the application it works fine when I just use my laptop screen or when I have a second screen plugged in.

The problem comes when I try to switch between them, for example when I open the application on the second screen, then disconnect the second screen I am unable to get the application to show in my laptop screen.

I believe that the application is still open at the location on the second screen which no longer exists.

I wondered how I can make my application update/check its location so it does not get lost when the second screen is removed?
I have had a look into QWindow & QDesktopWidget Class but can't seem to find a simple elegant solution to my problem.

Windows Application
Qt 5.4

14th October 2015, 15:15


14th October 2015, 16:01
Thanks for that link, I had previously seen it but was unsure on how best to implement it to stop my application form getting lost on a second screen.

14th October 2015, 19:25
When a screen gets removed, you get the screen of your window and compare.
If that is the screen that just went away, you use setScreen() with e.g. the primary screen or the first screen in screens()