I am using the following code to switch between full screen and maximized window,
void MainWindow::keyPressEvent(QKeyEvent *e)
{
if ((e->key()==Qt::Key_Enter) && (e->modifiers()==Qt::AltModifier))
this->setWindowState(Qt::WindowFullScreen);
if (e->key()==Qt::Key_Escape)
if(isFullScreen())
this->setWindowState(Qt::WindowMaximized);
}
but this doesn’t work.Can anybudy tell me what’s the problem here??
You shouldn’t use:
to check key modifiers because the modifiers() function returns flags.
Use something like:
or