我遇到了一些连接问题:
QAction* fs = new QAction(this);
fs->setShortcut(Qt::Key_F);
connect(fs, &QAction::triggered, this, &MainWindow::fullscreen);
menuBar()->addAction(fs);
全屏功能是:
if(!fullscreenMode)
{
mouseMoved=time(0);
this->menuBar()->hide();
this->showFullScreen();
fullscreenMode=true;
}
else
{
this->menuBar()->show();
timeBar->show();
controlBar->show();
this->showNormal();
fullscreenMode=false;
timeBar->visibilityChanged(true);
controlBar->visibilityChanged(true);
}
我无法使用快捷键(F按钮)恢复正常模式,但我可以使用相同功能的双击来完成。我的错误在哪里?
答案 0 :(得分:1)
答案是:
QShortcut* fullscreenShortcut = new QShortcut(QKeySequence(Qt::Key_F),this,SLOT(fullscreen()));