diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2022-09-16 15:29:10 +0200 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2022-09-29 08:20:56 +0200 |
commit | 72a3da3d4d69e09e90399aef8434cc6b194ff984 (patch) | |
tree | 502a20d26be5cecc4a86729046f344888bda6a81 /src/gui/text | |
parent | b6db79d82f10ff13e2688a298a7bb328999641e5 (diff) |
Style sheets: add placeholder text color property for edit widgets
The placeholder text was given its own QPalette color role in Qt 5.12,
but there has been no way to specify it from a Qt style sheet.
Fixes: QTBUG-93009
Change-Id: If58ca844c19c65b7eee14c6d5730a4ba27640c33
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qcssparser.cpp | 4 | ||||
-rw-r--r-- | src/gui/text/qcssparser_p.h | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index eff9ffbc8c..48f388984b 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -128,6 +128,7 @@ static const QCssKnownValue properties[NumProperties - 1] = { { "padding-top", PaddingTop }, { "page-break-after", PageBreakAfter }, { "page-break-before", PageBreakBefore }, + { "placeholder-text-color", QtPlaceHolderTextColor }, { "position", Position }, { "right", Right }, { "selection-background-color", QtSelectionBackground }, @@ -1340,7 +1341,7 @@ bool ValueExtractor::extractFont(QFont *font, int *fontSizeAdjustment) return hit; } -bool ValueExtractor::extractPalette(QBrush *fg, QBrush *sfg, QBrush *sbg, QBrush *abg) +bool ValueExtractor::extractPalette(QBrush *fg, QBrush *sfg, QBrush *sbg, QBrush *abg, QBrush *pfg) { bool hit = false; for (int i = 0; i < declarations.count(); ++i) { @@ -1350,6 +1351,7 @@ bool ValueExtractor::extractPalette(QBrush *fg, QBrush *sfg, QBrush *sbg, QBrush case QtSelectionForeground: *sfg = decl.brushValue(pal); break; case QtSelectionBackground: *sbg = decl.brushValue(pal); break; case QtAlternateBackground: *abg = decl.brushValue(pal); break; + case QtPlaceHolderTextColor: *pfg = decl.brushValue(pal); break; default: continue; } hit = true; diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h index cc50fb76b1..53399137d5 100644 --- a/src/gui/text/qcssparser_p.h +++ b/src/gui/text/qcssparser_p.h @@ -166,6 +166,7 @@ enum Property { LetterSpacing, WordSpacing, TextDecorationColor, + QtPlaceHolderTextColor, NumProperties }; @@ -823,7 +824,7 @@ struct Q_GUI_EXPORT ValueExtractor bool extractBox(int *margins, int *paddings, int *spacing = nullptr); bool extractBorder(int *borders, QBrush *colors, BorderStyle *Styles, QSize *radii); bool extractOutline(int *borders, QBrush *colors, BorderStyle *Styles, QSize *radii, int *offsets); - bool extractPalette(QBrush *fg, QBrush *sfg, QBrush *sbg, QBrush *abg); + bool extractPalette(QBrush *fg, QBrush *sfg, QBrush *sbg, QBrush *abg, QBrush *pfg); int extractStyleFeatures(); bool extractImage(QIcon *icon, Qt::Alignment *a, QSize *size); bool extractIcon(QIcon *icon, QSize *size); |