feat: shortcuts for zoom in and out

This also fix maximize shortcut on Windows.
This commit is contained in:
Gary Wang 2021-02-18 23:44:23 +08:00
parent 858c9e0ccf
commit 50170eb4aa
2 changed files with 6 additions and 2 deletions

View File

@ -57,10 +57,11 @@ void ActionManager::retranslateUi(MainWindow *mainWindow)
void ActionManager::setupShortcuts() void ActionManager::setupShortcuts()
{ {
actionZoomIn->setShortcut(QKeySequence(QKeySequence::ZoomIn));
actionZoomOut->setShortcut(QKeySequence(QKeySequence::ZoomOut));
actionQuitApp->setShortcuts({ actionQuitApp->setShortcuts({
QKeySequence(Qt::Key_Space), QKeySequence(Qt::Key_Space),
QKeySequence(Qt::Key_Escape) QKeySequence(Qt::Key_Escape)
}); });
actionQuitApp->setShortcutContext(Qt::ApplicationShortcut);
} }

View File

@ -11,7 +11,10 @@ FramelessWindow::FramelessWindow(QWidget *parent)
: QWidget(parent) : QWidget(parent)
, m_centralLayout(new QVBoxLayout(this)) , m_centralLayout(new QVBoxLayout(this))
{ {
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint); // A frameless window has the Qt::WindowTitleHint flag seems wrong,
// but it's a workaround of the following bug (also see the focused comment):
// https://bugreports.qt.io/browse/QTBUG-8361?focusedCommentId=542002#comment-542002
this->setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::FramelessWindowHint);
m_centralLayout->setMargin(0); m_centralLayout->setMargin(0);
} }