From e330fb0eb2ac67c8b1b47bbdb13c108534926b44 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sat, 6 Oct 2018 17:12:54 +0200 Subject: Show subwindow system menu at correct position --- src/mainwindow/mainwindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/mainwindow/mainwindow.cpp') diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp index cabc94b..d191fac 100644 --- a/src/mainwindow/mainwindow.cpp +++ b/src/mainwindow/mainwindow.cpp @@ -191,7 +191,10 @@ MainWindow::MainWindow(const std::unique_ptr &config, QWidget *pa connect(subwindowMenuAction, &QAction::triggered, this, [this]() { QMdiSubWindow *window = mdiArea->currentSubWindow(); if(window) { - window->systemMenu()->exec(); + // show the menu at the subwindow position + // position has to be global, and mapped by the mdiArea (parentWidget() of the subwindow) + const auto position = mdiArea->mapToGlobal(window->pos()); + window->systemMenu()->exec(position); } }); } -- cgit v1.2.1