summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWladimir Leuschner <wladimir.leuschner@qt.io>2024-04-09 10:44:22 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2024-04-11 02:35:27 +0000
commit61b71ffb3b2b34aea67306c973ee751335733433 (patch)
tree1a9a99c85bb1d5a0cb7ac3bcd89770684898321d
parent74e0ed217fdec8e32227f9f845eccac7f1552297 (diff)
QComboBox: Revert recreation of ComboBox Container on style change
In commit 9da8d67b3bca1d40ae221a9c6be218fe57759724 a recreation of the ComboBox Container was introduced, since QWindows11Style depends on WA_TranslucentBackground flag, whereas the other styles don't set this flag. This leads to the destruction of user supplied views we don't own. Fixes: QTBUG-124191 Pick-to: 6.7 Change-Id: I4a693f612ddc299696b9de0d87c94d88c04d9b39 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--src/widgets/widgets/qcombobox.cpp18
1 files changed, 1 insertions, 17 deletions
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 06de5566ff..1fe9a8d7be 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -3003,24 +3003,8 @@ void QComboBox::changeEvent(QEvent *e)
Q_D(QComboBox);
switch (e->type()) {
case QEvent::StyleChange:
- if (d->container) {
-// If on Windows, force recreation of ComboBox container, since
-// windows11 style depends on WA_TranslucentBackground
-#ifdef Q_OS_WIN
- auto delegate = itemDelegate();
- d->container->deleteLater();
- // d->container needs to be set explicitly to nullptr
- // since QComboBoxPrivate::viewContainer() only
- // creates a new QComboBoxPrivateContainer when
- // d->container has the value of nullptr
- d->container = nullptr;
- d->container = d->viewContainer();
- delegate->setParent(d->container);
- setItemDelegate(delegate);
-
-#endif
+ if (d->container)
d->container->updateStyleSettings();
- }
d->updateDelegate();
#ifdef Q_OS_MAC