QT 5.0 fullscreen mode behavior changed in Windows 7?
-
In a dual-screen configuration switching a window into fullscreen mode did not change the screen in all versions up to 4.8.4. In Qt 5, however, this is no longer true. Instead the window alway uses the main screen (screen 0). Is this intended behavior or just a bug?
I really need the old behaviour and would appreciate if someone knows a way to influence the target screen for fullscreen mode.
-
you can change the window to a different screen, but i have no idea ( geometry doesn't work ) how to use both screens.
Here an example to use the last screen:
@ QList<QScreen *> screenList = app.screens();
viewer.setScreen(screenList.last()); viewer.showFullScreen();@
-
Thanks for the response. Unfortunately it did not work. I assumed from your example that setScreen() is a member of QWidget, but this is not the case. What type is the variable "viewer" you use in your snippet? Has you ever sucessfully used this method in Qt 5?
-
Thanks again! The method setScreen() is a member of QWindows but not of QWidget. However, there is a member QWidget::windowHandle() that returns the pointer to the actual QWindow (although marked as "preliminary" in the documentation).
Therefore, using
ex->windowHandle()->setScreen(screenList.last())
where ex is a pointer to a QWidget, does the trick.
-
The above mentioned method works at least on Windows7, that is, on my dual-monitor system
@QWidget *ex = <assign a pointer to an existing QWidget object>;
QList<QScreen *> screenList = app.screens();
ex->windowHandle()->setScreen(screenList.last());
ex->showFullScreen();@opens a window on the second screen. Please note that QWidget::windowHandle() returns a pointer to QWindow, not a constant.