From 93d1ca928ecee8b44f0a106a1d02efde7057f448 Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Sat, 25 Jun 2022 23:52:35 +0800 Subject: [PATCH] chore: allow Meta+Up to maximize under Windows with Qt 6 --- app/framelesswindow.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/framelesswindow.cpp b/app/framelesswindow.cpp index 28c5cb9..679c6c9 100644 --- a/app/framelesswindow.cpp +++ b/app/framelesswindow.cpp @@ -15,11 +15,15 @@ FramelessWindow::FramelessWindow(QWidget *parent) : QWidget(parent) , m_centralLayout(new QVBoxLayout(this)) { - // We should use Qt::WindowMinMaxButtonsHint here but there is a bug in Qt - // that will make pressing Meta+Up cause the app fullscreen under Windows, - // so for now we only use the Qt::WindowMinimizeButtonHint flag here. - // https://bugreports.qt.io/browse/QTBUG-91226 + // TODO: Remove the comment below when we switch to Qt 6 completely. + // There is a bug in Qt 5 that will make pressing Meta+Up cause the app + // fullscreen under Windows, see QTBUG-91226 to learn more. + // The bug seems no longer exists in Qt 6 (I only tested it under Qt 6.3.0). +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint); +#else this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint); +#endif // QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) m_centralLayout->setContentsMargins(QMargins()); }