How to set QWidget fullscreen (but "real" fullscreen, change resolution, set modal to whole system)?

neciu picture neciu · Feb 23, 2012 · Viewed 21.7k times · Source

I'm trying to make a game using Qt, cause it is so awesome ;) and you have all the stuff you need for free. The only problem is in changing system resolution and setting QWidget (or QGLWidget) "real" fullscreen.

Have any one of you managed to do something like this? How was the portability of such approach? I'd like to deploy my app on all desktop systems.

Maybe use SDL or something like SMFL to make it fullscreen?

Pls, share your hacks!

Cheers.

Answer

Exa picture Exa · Feb 23, 2012

This...

my_widget->setWindowState(Qt::WindowFullScreen);

... brings your widget to a full screen resolution. Isn't that what you need?

Edit: Alternatively you can call the slot showFullScreen.

Edit 2:

  1. WIN API
    1. EnumDisplaySettings
    2. ChangeDisplaySettings
    3. Detailed information
  2. X11
    1. I'm not familiar with this, you could ask a new question regarding how to change the screen resolution here
  3. Mac
    1. Same as X11