How to show window in fullscreen mode?
Hi, i'm using Qt5.5 on my computer.
This is my code.
QApplication a(argc, argv); MainWindow w; QScreen *screen =QGuiApplication::primaryScreen(); QRect screenGeometry = screen->geometry(); int height1 = screenGeometry.height(); int width1 = screenGeometry.width(); qDebug()<<height1; qDebug()<<width1; w.resize(width1,height1); qDebug("mainwindow"); return a.exec();
It's no problem when compiling.
But when i execute my program main window can't show it up.
Why is this happened?
The reason, that the window does not show is simple.
You do not call anywhere
in your main.cpp :)
But is that resize can do the show out ability?
no, calling resize on a widget does not automatically show the widget.
w.resize(width1,height1); w.show(); return a.exec();
I'm not even sure if resize is processed if the widget is hidden and not just sheduled to be resized once the widget is shown.
@victor-wang Also what you are doing is not full screen!
You just maximize the window (for that there is a better way).
If you want to enter full screen read http://stackoverflow.com/questions/25269248/qt-qmainwindow-fullscreen-without-borders