PDA

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



JimGib
14th October 2015, 14:13
Hi,

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

anda_skoa
14th October 2015, 15:15
http://doc.qt.io/qt-5/qguiapplication.html#screenRemoved

Cheers,
_

JimGib
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.

anda_skoa
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()

Cheers,
_