diff options
author | Axel Spoerl <axel.spoerl@qt.io> | 2023-03-22 11:09:41 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-03-28 09:15:03 +0000 |
commit | 7af192d52006fc5686c3db1ba91ecdc8503ee0cb (patch) | |
tree | d5586d077cdd7854383dc8ae695cb2bb6278933a /src | |
parent | 4d8cfc44053bebc168e57630a2ee737aabf48e11 (diff) |
Explicitly propagate screen to QComboBoxListView constructor
QComboBoxListView is constructed without a parent. It therefore
inherits the current screen, which normally is the screen on which the
related QComboBox is located.
With two identical screens in Windows, that can lead to the popup
showing on the wrong screen. The issue occurs, when the other screen
is found before the right one.
This patch calls setScreen() in the constructor, to explicitly inherit
the screen from the combobox, if a valid pointer is passed.
Fixes: QTBUG-106099
Change-Id: Ic6679cfd59291092294d2cc75632a5485c2529b7
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit df0b661bfc015bfe3eaeed3e811d63c91929e61c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/widgets/qcombobox_p.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h index 2e34c14063..e33525ecab 100644 --- a/src/widgets/widgets/qcombobox_p.h +++ b/src/widgets/widgets/qcombobox_p.h @@ -85,7 +85,11 @@ class QComboBoxListView : public QListView { Q_OBJECT public: - QComboBoxListView(QComboBox *cmb = nullptr) : combo(cmb) {} + QComboBoxListView(QComboBox *cmb = nullptr) : combo(cmb) + { + if (cmb) + setScreen(cmb->screen()); + } protected: void resizeEvent(QResizeEvent *event) override |