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?
Please help! -
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?
Please help!The reason, that the window does not show is simple.
You do not call anywhere
w.show();
in your main.cpp :)
-
The reason, that the window does not show is simple.
You do not call anywhere
w.show();
in your main.cpp :)
@J.Hilk
But is that resize can do the show out ability? -
@J.Hilk
But is that resize can do the show out ability?@victor-wang
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.
-
@J.Hilk
But is that resize can do the show out ability?@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 -
@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@J-Hilk
I add show and it's worked.
i'm using resize on not only window but also the other widgets.
It can work for me.
@jsulm
I had used this it work for me too.
Thank you very much.