From bbc93065221fa7884e4ceabec405d8c87413252a Mon Sep 17 00:00:00 2001 From: reionwong Date: Sun, 17 Oct 2021 17:17:06 +0800 Subject: [PATCH] Add margin to the pop-up menu location --- src/desktop/menupopupwindow.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/desktop/menupopupwindow.cpp b/src/desktop/menupopupwindow.cpp index a1fbc58..18e7b54 100644 --- a/src/desktop/menupopupwindow.cpp +++ b/src/desktop/menupopupwindow.cpp @@ -45,6 +45,7 @@ void MenuPopupWindow::applicationStateChanged(Qt::ApplicationState state) void MenuPopupWindow::show() { QPoint pos = QCursor::pos(); + const int margin = 6; int w = m_contentItem->implicitWidth(); int h = m_contentItem->implicitHeight() + 16; int posx = pos.x(); @@ -64,7 +65,7 @@ void MenuPopupWindow::show() int submenuOverlap = pw->x() + pw->width() - posx; posx -= pw->width() + w - 2 * submenuOverlap; } else { - posx = g.right() - w; + posx = g.right() - w - margin; } } else { posx = qMax(posx, g.left()); @@ -73,7 +74,7 @@ void MenuPopupWindow::show() m_mouseMoved = false; m_dismissed = false; - posy = qBound(g.top(), posy, g.bottom() - h); + posy = qBound(g.top(), posy, g.bottom() - h - margin); setGeometry(posx, posy, w, h);