Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Store windowState



  • Qt::WindowState winState;
    
    void MainWindow::enterFullScreen()
    {   
        winState = windowState(); //error: assigning to 'Qt::WindowState' from incompatible type 'Qt::WindowStates' (aka 'QFlags<Qt::WindowState>')
        showFullScreen();  
    }
    
    void MainWindow::exitFullScreen()
    {
        if (winState == Qt::WindowNoState)
            showNormal();
        else if (winState == Qt::WindowMaximized)
            showMaximized();    
    }
    

  • Lifetime Qt Champion

    Hi,

    The solution is in the error message you got. If not clear, please read the documentation of the method QWidget::windowState.


Log in to reply