cabana: press F11 to toggle fullscreen (#27455)

This commit is contained in:
Dean Lee
2023-03-01 07:50:30 +08:00
committed by GitHub
parent ce3e9d5649
commit 8d317ef51c
2 changed files with 16 additions and 0 deletions

View File

@@ -194,6 +194,8 @@ void MainWindow::createStatusBar() {
void MainWindow::createShortcuts() {
auto shortcut = new QShortcut(QKeySequence(Qt::Key_Space), this, nullptr, nullptr, Qt::ApplicationShortcut);
QObject::connect(shortcut, &QShortcut::activated, []() { can->pause(!can->isPaused()); });
shortcut = new QShortcut(QKeySequence(QKeySequence::FullScreen), this, nullptr, nullptr, Qt::ApplicationShortcut);
QObject::connect(shortcut, &QShortcut::activated, this, &MainWindow::toggleFullScreen);
// TODO: add more shortcuts here.
}
@@ -482,6 +484,19 @@ void MainWindow::onlineHelp() {
}
}
void MainWindow::toggleFullScreen() {
if (isFullScreen()) {
menuBar()->show();
statusBar()->show();
showNormal();
showMaximized();
} else {
menuBar()->hide();
statusBar()->hide();
showFullScreen();
}
}
// HelpOverlay
HelpOverlay::HelpOverlay(MainWindow *parent) : QWidget(parent) {
setAttribute(Qt::WA_NoSystemBackground, true);

View File

@@ -56,6 +56,7 @@ protected:
void undoStackCleanChanged(bool clean);
void undoStackIndexChanged(int index);
void onlineHelp();
void toggleFullScreen();
void updateStatus();
VideoWidget *video_widget = nullptr;