QComboBox: Revert recreation of ComboBox Container on style change
In commit 9da8d67b3b 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>
bb10
parent
74e0ed217f
commit
61b71ffb3b
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue