mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
feat: hide all popup menus when press leftbutton on somewhere else
Log: according to the bug on https://bugreports.qt.io/browse/QTBUG-83972, The menu will always stay if not click one of the item. So I try to make a hack for it, wait qt solve it someday
This commit is contained in:
parent
1d8fc18304
commit
7d95ac23ce
5 changed files with 39 additions and 0 deletions
|
@ -25,6 +25,14 @@ Item {
|
||||||
|
|
||||||
property string searchString: ""
|
property string searchString: ""
|
||||||
|
|
||||||
|
// HACK: https://bugreports.qt.io/browse/QTBUG-83972, qtwayland cannot auto hide menu
|
||||||
|
Connections {
|
||||||
|
function onHideMenu() {
|
||||||
|
messageContextMenu.close()
|
||||||
|
}
|
||||||
|
target: MainWindow
|
||||||
|
}
|
||||||
|
|
||||||
ScrollBar {
|
ScrollBar {
|
||||||
id: scrollbar
|
id: scrollbar
|
||||||
parent: chat.parent
|
parent: chat.parent
|
||||||
|
|
|
@ -20,6 +20,15 @@ Page {
|
||||||
property int avatarSize: Math.ceil(fontMetrics.lineSpacing * 2.3)
|
property int avatarSize: Math.ceil(fontMetrics.lineSpacing * 2.3)
|
||||||
property bool collapsed: false
|
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 {
|
Component {
|
||||||
id: roomDirectoryComponent
|
id: roomDirectoryComponent
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,14 @@ Pane {
|
||||||
|
|
||||||
property string searchString: ""
|
property string searchString: ""
|
||||||
|
|
||||||
|
// HACK: https://bugreports.qt.io/browse/QTBUG-83972, qtwayland cannot auto hide menu
|
||||||
|
Connections {
|
||||||
|
function onHideMenu() {
|
||||||
|
roomOptionsMenu.close()
|
||||||
|
}
|
||||||
|
target: MainWindow
|
||||||
|
}
|
||||||
|
|
||||||
onRoomIdChanged: {
|
onRoomIdChanged: {
|
||||||
searchString = "";
|
searchString = "";
|
||||||
searchButton.searchActive = false;
|
searchButton.searchActive = false;
|
||||||
|
|
|
@ -359,6 +359,16 @@ MainWindow::event(QEvent *event)
|
||||||
return QQuickView::event(event);
|
return QQuickView::event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HACK: https://bugreports.qt.io/browse/QTBUG-83972, qtwayland cannot auto hide menu
|
||||||
|
void
|
||||||
|
MainWindow::mousePressEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (event->button() == Qt::LeftButton) {
|
||||||
|
emit hideMenu();
|
||||||
|
}
|
||||||
|
return QQuickView::mousePressEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWindow::restoreWindowSize()
|
MainWindow::restoreWindowSize()
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,6 +69,8 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
bool event(QEvent *event) override;
|
bool event(QEvent *event) override;
|
||||||
|
// HACK: https://bugreports.qt.io/browse/QTBUG-83972, qtwayland cannot auto hide menu
|
||||||
|
void mousePressEvent(QMouseEvent *) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! Handle interaction with the tray icon.
|
//! Handle interaction with the tray icon.
|
||||||
|
@ -77,6 +79,8 @@ private slots:
|
||||||
virtual void setWindowTitle(int notificationCount);
|
virtual void setWindowTitle(int notificationCount);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
// HACK: https://bugreports.qt.io/browse/QTBUG-83972, qtwayland cannot auto hide menu
|
||||||
|
void hideMenu();
|
||||||
void reload();
|
void reload();
|
||||||
void secretsChanged();
|
void secretsChanged();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue