summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dist/changes-4.8.01
-rw-r--r--src/gui/styles/qplastiquestyle.cpp5
-rw-r--r--src/gui/styles/qwindowsvistastyle.cpp4
-rw-r--r--src/gui/widgets/qcombobox.cpp2
-rw-r--r--tests/auto/qcombobox/tst_qcombobox.cpp12
5 files changed, 16 insertions, 8 deletions
diff --git a/dist/changes-4.8.0 b/dist/changes-4.8.0
index 0c28274..f8ca4bc 100644
--- a/dist/changes-4.8.0
+++ b/dist/changes-4.8.0
@@ -42,6 +42,7 @@ QtGui
-----
- QTabBar: reduced minimumSizeHint if ElideMode is set.
+ - QComboBox: Fixed a color propagation issue with the lineedit. [QTBUG-5950]
QtOpenGL
--------
diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp
index 4690a71..8772294 100644
--- a/src/gui/styles/qplastiquestyle.cpp
+++ b/src/gui/styles/qplastiquestyle.cpp
@@ -1362,11 +1362,8 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
if (const QStyleOptionFrame *lineEdit = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
// Panel of a line edit inside combo box or spin box is drawn in CC_ComboBox and CC_SpinBox
if (widget) {
-#ifndef QT_NO_COMBOBOX
- if (qobject_cast<const QComboBox *>(widget->parentWidget()))
- break;
-#endif
#ifndef QT_NO_SPINBOX
+ // Spinbox doesn't need a separate palette for the lineedit
if (qobject_cast<const QAbstractSpinBox *>(widget->parentWidget()))
break;
#endif
diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp
index bed5b09..d6d3f10 100644
--- a/src/gui/styles/qwindowsvistastyle.cpp
+++ b/src/gui/styles/qwindowsvistastyle.cpp
@@ -588,10 +588,6 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
if (QAbstractSpinBox *spinbox = qobject_cast<QAbstractSpinBox*>(widget->parentWidget()))
resolve_mask = spinbox->palette().resolve();
#endif // QT_NO_SPINBOX
-#ifndef QT_NO_COMBOBOX
- if (QComboBox *combobox = qobject_cast<QComboBox*>(widget->parentWidget()))
- resolve_mask = combobox->palette().resolve();
-#endif // QT_NO_COMBOBOX
}
if (resolve_mask & (1 << QPalette::Base)) {
// Base color is set for this widget, so use it
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index 21dd127..b857e94 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -1089,6 +1089,8 @@ void QComboBoxPrivate::updateViewContainerPaletteAndOpacity()
container->setPalette(q->palette());
container->setWindowOpacity(1.0);
}
+ if (lineEdit)
+ lineEdit->setPalette(q->palette());
}
/*!
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp
index f00f3ef..71dab40 100644
--- a/tests/auto/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/qcombobox/tst_qcombobox.cpp
@@ -475,6 +475,18 @@ void tst_QComboBox::setPalette()
QVERIFY(((QWidget*)o)->palette() == pal);
}
}
+
+ testWidget->setEditable(true);
+ pal.setColor(QPalette::Base, Qt::red);
+ //Setting it on the lineedit should be separate form the combo
+ testWidget->lineEdit()->setPalette(pal);
+ QVERIFY(testWidget->palette() != pal);
+ QVERIFY(testWidget->lineEdit()->palette() == pal);
+ pal.setColor(QPalette::Base, Qt::green);
+ //Setting it on the combo directly should override lineedit
+ testWidget->setPalette(pal);
+ QVERIFY(testWidget->palette() == pal);
+ QVERIFY(testWidget->lineEdit()->palette() == pal);
}
void tst_QComboBox::sizeAdjustPolicy()