summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets
diff options
context:
space:
mode:
authorJoni Poikelin <joni.poikelin@qt.io>2017-01-24 20:12:04 +0200
committerJoni Poikelin <joni.poikelin@qt.io>2017-04-21 04:40:11 +0000
commit903a59042e4017d851d8b32f2f8568fd36aeb2c8 (patch)
tree2af5a0b46f0dc6a997d9d79e139bcc5e23b84d66 /src/widgets/widgets
parent2a41e05fdede94771295b39a3f19e0bf08ebcfcb (diff)
Fix QComboBox popup from opening on wrong screen
Nothing seems to be telling the popup on which screen it should be shown on. To fix this, simply set same screen the QComboBox uses to the popup. Task-number: QTBUG-58392 Change-Id: If62a26fe4e51bcf3d770ee72c9baa998541618f4 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r--src/widgets/widgets/qcombobox.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index b18066c174..2376a18e43 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -2746,6 +2746,22 @@ void QComboBox::showPopup()
bool startTimer = !container->isVisible();
container->raise();
+ container->create();
+ QWindow *containerWindow = container->window()->windowHandle();
+ if (containerWindow) {
+ QWindow *win = window()->windowHandle();
+ if (win) {
+ QScreen *currentScreen = win->screen();
+ if (currentScreen && !currentScreen->virtualSiblings().contains(containerWindow->screen())) {
+ containerWindow->setScreen(currentScreen);
+
+ // This seems to workaround an issue in xcb+multi GPU+multiscreen
+ // environment where the window might not always show up when screen
+ // is changed.
+ container->hide();
+ }
+ }
+ }
container->show();
container->updateScrollers();
view()->setFocus();