From 3f3d09cf1511dde99797671a7bc848cdabc8d7fa Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Wed, 8 Apr 2009 10:25:06 +0200 Subject: Revert "Bt: Fix regression in the Embedded dialogs example" This reverts commit 35c26d696cbff269d551c012a212c09692dd6f6b. The change to QComboBox introduces a behavior change; whereas before the view container would always get its palette set as a response to QEvent::PaletteChange, it would now miss this event and rely on regular palette propagation to get the right contens. The difference in behavior is that QWidget::setPalette() also resolves the palette mask, and after 35c26d69 this would no longer happen. The bug in the embedded dialogs demo is caused by the embedded dialogs demo. See upcoming commit. Reviewed-by: Alexis Reviewed-by: Jens Bache-Wiig --- demos/embeddeddialogs/customproxy.cpp | 11 ++--------- src/gui/widgets/qcombobox.cpp | 24 +++++++++++------------- 2 files changed, 13 insertions(+), 22 deletions(-) diff --git a/demos/embeddeddialogs/customproxy.cpp b/demos/embeddeddialogs/customproxy.cpp index ed2fc76..56a0548 100644 --- a/demos/embeddeddialogs/customproxy.cpp +++ b/demos/embeddeddialogs/customproxy.cpp @@ -111,15 +111,8 @@ bool CustomProxy::sceneEventFilter(QGraphicsItem *watched, QEvent *event) QVariant CustomProxy::itemChange(GraphicsItemChange change, const QVariant &value) { - if (change == ItemChildAddedChange || change == ItemChildRemovedChange) { - QGraphicsItem *item = qVariantValue(value); - if (change == ItemChildAddedChange) { - item->setCacheMode(ItemCoordinateCache); - item->installSceneEventFilter(this); - } else { - item->removeSceneEventFilter(this); - } - } + if (change == ItemChildRemovedChange) + removeSceneEventFilter(this); return QGraphicsProxyWidget::itemChange(change, value); } diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index b9dbc62..09a51fe 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -2572,21 +2572,19 @@ void QComboBox::changeEvent(QEvent *e) hidePopup(); break; case QEvent::PaletteChange: { - if (d->container) { - QStyleOptionComboBox opt; - initStyleOption(&opt); + QStyleOptionComboBox opt; + initStyleOption(&opt); #ifndef QT_NO_MENU - if (style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, this)) { - QMenu menu; - menu.ensurePolished(); - d->viewContainer()->setPalette(menu.palette()); - d->viewContainer()->setWindowOpacity(menu.windowOpacity()); - } else + if (style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, this)) { + QMenu menu; + menu.ensurePolished(); + d->viewContainer()->setPalette(menu.palette()); + d->viewContainer()->setWindowOpacity(menu.windowOpacity()); + } else #endif - { - d->viewContainer()->setPalette(palette()); - d->viewContainer()->setWindowOpacity(1.0); - } + { + d->viewContainer()->setPalette(palette()); + d->viewContainer()->setWindowOpacity(1.0); } break; } -- cgit v0.12