summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp1
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp16
2 files changed, 17 insertions, 0 deletions
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index d060be5572..6d3a9fcfeb 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -1473,6 +1473,7 @@ void QRenderRule::configurePalette(QPalette *p, QPalette::ColorGroup cg, const Q
p->setBrush(cg, w->foregroundRole(), pal->foreground);
p->setBrush(cg, QPalette::WindowText, pal->foreground);
p->setBrush(cg, QPalette::Text, pal->foreground);
+ p->setBrush(cg, QPalette::PlaceholderText, pal->foreground);
}
if (pal->selectionBackground.style() != Qt::NoBrush)
p->setBrush(cg, QPalette::Highlight, pal->selectionBackground);
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
index 3c33354cfe..f2f9be6bb6 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -124,6 +124,7 @@ private slots:
void QTBUG15910_crashNullWidget();
void QTBUG36933_brokenPseudoClassLookup();
void styleSheetChangeBeforePolish();
+ void placeholderColor();
//at the end because it mess with the style.
void widgetStyle();
void appStyle();
@@ -2222,6 +2223,21 @@ void tst_QStyleSheetStyle::highdpiImages()
QHighDpiScaling::updateHighDpiScaling(); // reset to normal
}
+void tst_QStyleSheetStyle::placeholderColor()
+{
+ const QColor red(Qt::red);
+ qApp->setStyleSheet("* { color: red; }");
+ QLineEdit le1;
+ QLineEdit le2;
+ le2.setEnabled(false);
+ le1.ensurePolished();
+ QCOMPARE(le1.palette().placeholderText(), red);
+ le2.ensurePolished();
+ QCOMPARE(le2.palette().placeholderText(), red);
+ le2.setEnabled(true);
+ QCOMPARE(le2.palette().placeholderText(), red);
+}
+
QTEST_MAIN(tst_QStyleSheetStyle)
#include "tst_qstylesheetstyle.moc"