diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 9caac239f9..e754d02f2a 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -58,7 +58,8 @@ QComboBoxPrivate::QComboBoxPrivate() shownOnce(false), duplicatesEnabled(false), frame(true), - inserting(false) + inserting(false), + hidingPopup(false) { } @@ -2805,6 +2806,13 @@ void QComboBox::showPopup() void QComboBox::hidePopup() { Q_D(QComboBox); + if (d->hidingPopup) + return; + d->hidingPopup = true; + // can't use QBoolBlocker on a bitfield + auto resetHidingPopup = qScopeGuard([d]{ + d->hidingPopup = false; + }); if (d->container && d->container->isVisible()) { #if QT_CONFIG(effects) QSignalBlocker modelBlocker(d->model); diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h index d725624d6d..a26f3a34d4 100644 --- a/src/widgets/widgets/qcombobox_p.h +++ b/src/widgets/widgets/qcombobox_p.h @@ -395,6 +395,7 @@ public: bool duplicatesEnabled : 1; bool frame : 1; bool inserting : 1; + bool hidingPopup : 1; }; QT_END_NAMESPACE