From f6cd0264c6e6f0bdb451e4f44284372e32e1db91 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Fri, 18 Jun 2010 16:05:16 +0200 Subject: QGraphicsProxyWidget: Fixes QComboBox popup closing issue. This happens when the QComboBox popup gets closed by QGraphicsScenePrivate::removePopup and then the QComboBox gets hidden. If the QComboBox gets shown again, the popup will be shown as well since it was not explicitly hidden. Reviewed-by: Yoann Lopes --- src/gui/graphicsview/qgraphicsscene.cpp | 3 +-- src/gui/widgets/qcombobox.cpp | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index ca3b56f..b821551 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -885,8 +885,7 @@ void QGraphicsScenePrivate::removePopup(QGraphicsWidget *widget, bool itemIsDyin ungrabKeyboard(static_cast(widget), itemIsDying); } if (!itemIsDying && widget->isVisible()) { - widget->hide(); - widget->QGraphicsItem::d_ptr->explicitlyHidden = 0; + widget->QGraphicsItem::d_ptr->setVisibleHelper(false, /* explicit = */ false); } } } diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index 1504066..dcc328f 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -704,6 +704,11 @@ void QComboBoxPrivateContainer::hideEvent(QHideEvent *) { emit resetButton(); combo->update(); + // QGraphicsScenePrivate::removePopup closes the combo box popup, it hides it non-explicitly. + // Hiding/showing the QComboBox after this will unexpectedly show the popup as well. + // Re-hiding the popup container makes sure it is explicitly hidden. + if (QGraphicsProxyWidget *proxy = graphicsProxyWidget()) + proxy->hide(); } void QComboBoxPrivateContainer::mousePressEvent(QMouseEvent *e) -- cgit v0.12