summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qcombobox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/widgets/qcombobox.cpp')
-rw-r--r--src/widgets/widgets/qcombobox.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index b7a084364b..937076a7b5 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -761,7 +761,9 @@ bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e)
QModelIndex indexUnderMouse = view->indexAt(m->position().toPoint());
if (indexUnderMouse.isValid()
&& !QComboBoxDelegate::isSeparator(indexUnderMouse)) {
- view->setCurrentIndex(indexUnderMouse);
+ // Request for comments: To show selected item with AccentColor bar indicator and hovered
+ // items in the flyout, the next line needs to be removed.
+ //view->setCurrentIndex(indexUnderMouse);
}
}
break;
@@ -2969,9 +2971,26 @@ void QComboBox::changeEvent(QEvent *e)
Q_D(QComboBox);
switch (e->type()) {
case QEvent::StyleChange:
- if (d->container)
+ 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
d->container->updateStyleSettings();
+ }
d->updateDelegate();
+
#ifdef Q_OS_MAC
case QEvent::MacSizeChange:
#endif