Fullscreen widget

后端 未结 2 1959
伪装坚强ぢ
伪装坚强ぢ 2020-12-08 07:10

How can I make my widget fullscreen? I\'ve tried something like this:

void MainWindow::SetFullScreen()
{
    // Make our window without panels
    this->s         


        
2条回答
  •  有刺的猬
    2020-12-08 07:29

    This code will allow you to set a full screen by double clicking and to return back to the normal view by double clicking again.

    void myWidget::mouseDoubleClickEvent(QMouseEvent *e) {
      QWidget::mouseDoubleClickEvent(e);
      if(isFullScreen()) {
         this->setWindowState(Qt::WindowMaximized);
      } else {
         this->setWindowState(Qt::WindowFullScreen);
      }
    }
    

提交回复
热议问题