diff options
author | Liang Qi <liang.qi@qt.io> | 2019-06-25 15:37:01 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-06-25 15:47:42 +0200 |
commit | aedc59b1c38528f96f0e0cc51bf6c9eeca9dca28 (patch) | |
tree | 80e38cea91c93736a7d4436642dd46c8b2dd6386 /src/widgets/widgets/qmenu.cpp | |
parent | e3b3dbbe93dbbac196543f62b444b2c044d14907 (diff) | |
parent | f6db25962e820d7709c2f235f02893dd3edde4f4 (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
src/corelib/io/qstorageinfo_unix.cpp
src/network/ssl/qsslsocket_openssl.cpp
Change-Id: Ibc9ce799bef62d60d616beaa9fbde8ebeadfbc20
Diffstat (limited to 'src/widgets/widgets/qmenu.cpp')
-rw-r--r-- | src/widgets/widgets/qmenu.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 287be3e272..7b6a1b6da8 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -2331,8 +2331,18 @@ void QMenu::popup(const QPoint &p, QAction *atAction) d->updateLayoutDirection(); // Ensure that we get correct sizeHints by placing this window on the correct screen. - if (d->setScreenForPoint(p)) + // However if the QMenu was constructed with a QDesktopScreenWidget as its parent, + // then initialScreenIndex was set, so we should respect that for the lifetime of this menu. + // Use d->popupScreen to remember, because initialScreenIndex will be reset after the first showing. + const int screenIndex = d->topData()->initialScreenIndex; + if (screenIndex >= 0) + d->popupScreen = screenIndex; + if (auto s = QGuiApplication::screens().value(d->popupScreen)) { + if (d->setScreen(s)) + d->itemsDirty = true; + } else if (d->setScreenForPoint(p)) { d->itemsDirty = true; + } const bool contextMenu = d->isContextMenu(); if (d->lastContextMenu != contextMenu) { |