diff options
author | DeepBlueV7.X <nicolas.werner@hotmail.de> | 2023-01-28 12:15:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-28 12:15:54 +0100 |
commit | 3abb49c4a2338f1d07ca68e27f3030b1a6f2a97f (patch) | |
tree | 2434425ffa8a55614e62eb4ccc8bc50c197d29c7 /src | |
parent | Make newline behave consistently in markdown mode (diff) | |
parent | chore: remove button check (diff) | |
download | nheko-3abb49c4a2338f1d07ca68e27f3030b1a6f2a97f.tar.xz |
Merge pull request #1319 from Decodetalkers/menuhideonwayland
feat: hide all popup menus when press leftbutton on somewhere else
Diffstat (limited to 'src')
-rw-r--r-- | src/MainWindow.cpp | 12 | ||||
-rw-r--r-- | src/MainWindow.h | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index dcb4be49..8c2b4c35 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -359,6 +359,18 @@ MainWindow::event(QEvent *event) return QQuickView::event(event); } +// HACK: https://bugreports.qt.io/browse/QTBUG-83972, qtwayland cannot auto hide menu +void +MainWindow::mousePressEvent(QMouseEvent *event) +{ +#if defined(Q_OS_LINUX) + if (QGuiApplication::platformName() == "wayland") { + emit hideMenu(); + } +#endif + return QQuickView::mousePressEvent(event); +} + void MainWindow::restoreWindowSize() { diff --git a/src/MainWindow.h b/src/MainWindow.h index 1664f849..bb23ff11 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -69,6 +69,8 @@ public: protected: void closeEvent(QCloseEvent *event); bool event(QEvent *event) override; + // HACK: https://bugreports.qt.io/browse/QTBUG-83972, qtwayland cannot auto hide menu + void mousePressEvent(QMouseEvent *) override; private slots: //! Handle interaction with the tray icon. @@ -77,6 +79,8 @@ private slots: virtual void setWindowTitle(int notificationCount); signals: + // HACK: https://bugreports.qt.io/browse/QTBUG-83972, qtwayland cannot auto hide menu + void hideMenu(); void reload(); void secretsChanged(); |