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
    @this->setWindowState(Qt::WindowFullScreen);@
    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();

    this->setFixedSize(vnWidth,vnHeight);



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

    @widget->setWindowFlags(Qt::WindowStaysOnTopHint|Qt::FramelessWindowHint);@

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

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.