make keyboard shortcut handling consistent across the entire app

This commit is contained in:
Axel Kohlmeyer
2023-10-13 05:59:20 -04:00
parent 506de7015d
commit 6195be5af7
5 changed files with 39 additions and 13 deletions

View File

@ -25,6 +25,7 @@
#include <QHBoxLayout>
#include <QImage>
#include <QImageReader>
#include <QKeySequence>
#include <QLabel>
#include <QPalette>
#include <QProcess>
@ -50,11 +51,11 @@ SlideShow::SlideShow(const QString &fileName, QWidget *parent) :
imageName->setAlignment(Qt::AlignCenter);
imageName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
auto *shortcut = new QShortcut(QKeySequence::fromString("Ctrl+W"), this);
auto *shortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this);
QObject::connect(shortcut, &QShortcut::activated, this, &QWidget::close);
shortcut = new QShortcut(QKeySequence::fromString("Ctrl+/"), this);
shortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Slash), this);
QObject::connect(shortcut, &QShortcut::activated, this, &SlideShow::stop_run);
shortcut = new QShortcut(QKeySequence::fromString("Ctrl+Q"), this);
shortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
QObject::connect(shortcut, &QShortcut::activated, this, &SlideShow::quit);
buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);