diff options
author | Christian Stenger <christian.stenger@qt.io> | 2023-12-06 09:56:47 +0100 |
---|---|---|
committer | Christian Stenger <christian.stenger@qt.io> | 2023-12-06 13:04:42 +0000 |
commit | d1ac2fe45a9a7986bfb9217f14bfc1ca22a9cdd9 (patch) | |
tree | ec0b08b2fa573984af99044ec18d350e36de1952 | |
parent | b360776b1f96dea4f74250ea09c79cfc77d9ed63 (diff) |
Adjust position of refactor submenu
Fixes: QTCREATORBUG-30010
Change-Id: Idf4ce4e3bc4d0af3d40460c8f2e27f52c90f2454
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | src/plugins/cppeditor/cppeditorwidget.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/cppeditor/cppeditorwidget.cpp b/src/plugins/cppeditor/cppeditorwidget.cpp index 8f06a363ea..b25150ddb7 100644 --- a/src/plugins/cppeditor/cppeditorwidget.cpp +++ b/src/plugins/cppeditor/cppeditorwidget.cpp @@ -1126,6 +1126,19 @@ QMenu *CppEditorWidget::createRefactorMenu(QWidget *parent) const case CppUseSelectionsUpdater::RunnerInfo::Invalid: QTC_CHECK(false && "Unexpected CppUseSelectionsUpdater runner result"); } + QMetaObject::invokeMethod(menu, [menu](){ + if (auto mainWin = ICore::mainWindow()) { + menu->adjustSize(); + if (QTC_GUARD(menu->parentWidget())) { + QPoint p = menu->pos(); + const int w = menu->width(); + if (p.x() + w > mainWin->screen()->geometry().width()) { + p.setX(menu->parentWidget()->x() - w); + menu->move(p); + } + } + } + }, Qt::QueuedConnection); }); return menu; |