Important: Please read the Qt Code of Conduct -

Qt Window Size

  • Using a Qt widget base application in Qt5.2.1 I would like to display the main window dynamically occupying the whole screen, how can I do that?
    One observation: Not all monitors have the same size, mine is very small compared to the ones at work.
    Thanks in advance

  • This works for a QMainWindow
    I'm not sure if it will work for a QWidget, but you can try it out

  • May it looks some bad. but In qt 4 main window can occupy whole screen.

    QDesktopWidget desktop;

    int vnWidth=desktop.geometry().width();
    int vnHeight=desktop.geometry().height();


  • If you want a full screen widget you had to do


    and after that call @widget->showFullScreen();@

    Also you can try the @this->setCentralWidget(widget);@ for the main window.

Log in to reply