diff options
Diffstat (limited to 'src/widgets/widgets/qwidgettextcontrol.cpp')
-rw-r--r-- | src/widgets/widgets/qwidgettextcontrol.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index e32f779bb0..b87b4e54fa 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -58,6 +58,7 @@ #include "private/qapplication_p.h" #include "private/qtextdocumentlayout_p.h" #include "private/qabstracttextdocumentlayout_p.h" +#include "private/qmenu_p.h" #include "qtextdocument.h" #include "private/qtextdocument_p.h" #include "qtextlist.h" @@ -1943,6 +1944,10 @@ void QWidgetTextControlPrivate::contextMenuEvent(const QPoint &screenPos, const if (!menu) return; menu->setAttribute(Qt::WA_DeleteOnClose); + if (auto *window = static_cast<QWidget *>(parent)->window()->windowHandle()) { + QMenuPrivate::get(menu)->topData()->initialScreenIndex = + QGuiApplication::screens().indexOf(window->screen()); + } menu->popup(screenPos); #endif } |