fullscreen button for particular widget



  • Hello!! I am trying to create a media player using Qt.I want to place a button for fullscreen mode.When I use the below code fullscreen works perfectly.

    QWidget::showMaximized();
    

    But I want to show only video widget like in the case of Vlc player.When I change my code to

    ui->video->showMaximized();
    

    the above code no error occurs but its not working at all(assuming I have a widget named 'video').So,how can I create a pushbutton for maximizing a particular widget only.(In my case video widget)?Thanks!


  • Lifetime Qt Champion

    Hi,

    Any chance that ui-video is inside a layout ?


  • Moderators

    You can only make windows fullscreen, so you need to first make your widget a window:

    ui->video->setWindowFlags(Qt::Window);
    ui->video->showMaximized();
    

    and to go back make it a widget again:

    ui->video->setWindowFlags(Qt::Widget);
    ui->video->show();
    


  • @SGaist yeah it's inside a horizontal layout.


Log in to reply
 

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