mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Merge pull request #1319 from Decodetalkers/menuhideonwayland
feat: hide all popup menus when press leftbutton on somewhere else
This commit is contained in:
commit
3abb49c4a2
5 changed files with 41 additions and 0 deletions
|
@ -25,6 +25,14 @@ Item {
|
|||
|
||||
property string searchString: ""
|
||||
|
||||
// HACK: https://bugreports.qt.io/browse/QTBUG-83972, qtwayland cannot auto hide menu
|
||||
Connections {
|
||||
function onHideMenu() {
|
||||
messageContextMenu.close()
|
||||
}
|
||||
target: MainWindow
|
||||
}
|
||||
|
||||
ScrollBar {
|
||||
id: scrollbar
|
||||
parent: chat.parent
|
||||
|
|
|
@ -20,6 +20,15 @@ Page {
|
|||
property int avatarSize: Math.ceil(fontMetrics.lineSpacing * 2.3)
|
||||
property bool collapsed: false
|
||||
|
||||
// HACK: https://bugreports.qt.io/browse/QTBUG-83972, qtwayland cannot auto hide menu
|
||||
Connections {
|
||||
function onHideMenu() {
|
||||
userInfoMenu.close()
|
||||
roomContextMenu.close()
|
||||
}
|
||||
target: MainWindow
|
||||
}
|
||||
|
||||
Component {
|
||||
id: roomDirectoryComponent
|
||||
|
||||
|
|
|
@ -30,6 +30,14 @@ Pane {
|
|||
|
||||
property string searchString: ""
|
||||
|
||||
// HACK: https://bugreports.qt.io/browse/QTBUG-83972, qtwayland cannot auto hide menu
|
||||
Connections {
|
||||
function onHideMenu() {
|
||||
roomOptionsMenu.close()
|
||||
}
|
||||
target: MainWindow
|
||||
}
|
||||
|
||||
onRoomIdChanged: {
|
||||
searchString = "";
|
||||
searchButton.searchActive = false;
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue