summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Bache-Wiig <jbache@trolltech.com>2009-04-07 14:37:08 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2009-04-08 02:33:48 (GMT)
commit291953f9b3a913f7200c396406567c7ccea0c6cc (patch)
tree484d22b9a38fe8f323077f6b8f71a4c5593923e2
parent1da42bc25d414b52de0996608cbaf59c5cd3bf81 (diff)
downloadQt-291953f9b3a913f7200c396406567c7ccea0c6cc.zip
Qt-291953f9b3a913f7200c396406567c7ccea0c6cc.tar.gz
Qt-291953f9b3a913f7200c396406567c7ccea0c6cc.tar.bz2
Bt: Fix regression in the Embedded dialogs example
We had to revert an earlier fix since it obviously did not work correctly. However since we do not really need to propagate the palette on the viewContainer _before_ it is created, we can simply avoid the issue alltogether as it would happen because we implicitly added a child widget during the polish of the combo box. Reviewed-by: nrc (cherry picked from commit 35c26d696cbff269d551c012a212c09692dd6f6b)
-rw-r--r--demos/embeddeddialogs/customproxy.cpp11
-rw-r--r--src/gui/widgets/qcombobox.cpp24
2 files changed, 22 insertions, 13 deletions
diff --git a/demos/embeddeddialogs/customproxy.cpp b/demos/embeddeddialogs/customproxy.cpp
index 56a0548..ed2fc76 100644
--- a/demos/embeddeddialogs/customproxy.cpp
+++ b/demos/embeddeddialogs/customproxy.cpp
@@ -111,8 +111,15 @@ bool CustomProxy::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
QVariant CustomProxy::itemChange(GraphicsItemChange change, const QVariant &value)
{
- if (change == ItemChildRemovedChange)
- removeSceneEventFilter(this);
+ if (change == ItemChildAddedChange || change == ItemChildRemovedChange) {
+ QGraphicsItem *item = qVariantValue<QGraphicsItem *>(value);
+ if (change == ItemChildAddedChange) {
+ item->setCacheMode(ItemCoordinateCache);
+ item->installSceneEventFilter(this);
+ } else {
+ item->removeSceneEventFilter(this);
+ }
+ }
return QGraphicsProxyWidget::itemChange(change, value);
}
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index 09a51fe..b9dbc62 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -2572,19 +2572,21 @@ void QComboBox::changeEvent(QEvent *e)
hidePopup();
break;
case QEvent::PaletteChange: {
- QStyleOptionComboBox opt;
- initStyleOption(&opt);
+ if (d->container) {
+ 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;
}