summaryrefslogtreecommitdiffstats
path: root/src/widgets/doc
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2022-09-16 15:29:10 +0200
committerEirik Aavitsland <eirik.aavitsland@qt.io>2022-09-29 08:20:56 +0200
commit72a3da3d4d69e09e90399aef8434cc6b194ff984 (patch)
tree502a20d26be5cecc4a86729046f344888bda6a81 /src/widgets/doc
parentb6db79d82f10ff13e2688a298a7bb328999641e5 (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/widgets/doc')
-rw-r--r--src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc3
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc26
2 files changed, 28 insertions, 1 deletions
diff --git a/src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc b/src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc
index 6b4a472275..d505040590 100644
--- a/src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc
+++ b/src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc
@@ -1849,3 +1849,6 @@ QTableView::indicator:unchecked {
* { widget-animation-duration: 100 }
//! [162]
+//! [163]
+QLineEdit { placeholder-text-color: #800000ff } /* semi-transparent blue */
+//! [163]
diff --git a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
index 46c28c5fc4..fc7193c7bd 100644
--- a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
@@ -732,6 +732,9 @@
subcontrol. By default, the arrow is placed in the center of the
contents rectangle of the drop-down subcontrol.
+ The color of the placeholder text can be set using the
+ \l{#placeholder-text-color-prop}{placeholder-text-color} property.
+
See \l{Qt Style Sheets Examples#Customizing QComboBox}{Customizing QComboBox}
for an example.
@@ -841,13 +844,16 @@
\row
\li QLineEdit \target qlineedit-widget
- \li Support the \l{box model}.
+ \li Supports the \l{box model}.
The color and background of the selected item is styled using
\l{#selection-color-prop}{selection-color} and
\l{#selection-background-color-prop}{selection-background-color}
respectively.
+ The color of the placeholder text can be set using the
+ \l{#placeholder-text-color-prop}{placeholder-text-color} property.
+
The password character can be styled using the
\l{#lineedit-password-character-prop}{lineedit-password-character}
property.
@@ -1202,6 +1208,9 @@
\l{#selection-background-color-prop}{selection-background-color}
respectively.
+ The color of the placeholder text can be set using the
+ \l{#placeholder-text-color-prop}{placeholder-text-color} property.
+
See \l{qabstractscrollarea-widget}{QAbsractScrollArea} to
style scrollable backgrounds.
@@ -2299,6 +2308,21 @@
area (i.e the area where there are no items)
\row
+ \li \b{\c placeholder-text-color*} \target placeholder-text-color-prop
+ \li \l{#Brush}{Brush} \br
+ \li The color used for the placeholder text of text editing widgets.
+
+ If this property is not set, the default value is whatever
+ is set for the palette's \l{QPalette::}{PlaceholderText}
+ role.
+
+ Example:
+
+ \snippet code/doc_src_stylesheet.qdoc 163
+
+ Available since 6.5.
+
+ \row
\li \b{\c position} \target position-prop
\li \c relative \br
| \c absolute