Search code examples
c++qtwindowqt-creatorfullscreen

QT QMainWindow fullscreen without borders


How to do a fullscreen without borders using QMainWindow ? I got a fullscreen including window borders all around the screen. I would like to have a "real" fullscreen like video games. Not a windowed fullscreen.

I tried:

MainWindow mainWindow;
mainWindow.setWindowState(Qt::WindowFullScreen);
mainWindow.showFullScreen();

MainWindow extend of QMainWindow.


Solution

  • You want to setWindowFlags, with Qt::FramelessWindowHint and Qt::CustomizeWindowHint. So mainWindow->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint) should work for you.