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 /examples/widgets | |
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 'examples/widgets')
-rw-r--r-- | examples/widgets/widgets/stylesheet/mainwindow.cpp | 1 | ||||
-rw-r--r-- | examples/widgets/widgets/stylesheet/qss/coffee.qss | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/examples/widgets/widgets/stylesheet/mainwindow.cpp b/examples/widgets/widgets/stylesheet/mainwindow.cpp index a2f477c83d..a43613c757 100644 --- a/examples/widgets/widgets/stylesheet/mainwindow.cpp +++ b/examples/widgets/widgets/stylesheet/mainwindow.cpp @@ -12,6 +12,7 @@ MainWindow::MainWindow(QWidget *parent) ui.setupUi(this); ui.nameLabel->setProperty("class", "mandatory QLabel"); + ui.nameCombo->lineEdit()->setPlaceholderText(tr("Last, First")); styleSheetEditor = new StyleSheetEditor(this); diff --git a/examples/widgets/widgets/stylesheet/qss/coffee.qss b/examples/widgets/widgets/stylesheet/qss/coffee.qss index 4571d42d7e..8f72a15ee5 100644 --- a/examples/widgets/widgets/stylesheet/qss/coffee.qss +++ b/examples/widgets/widgets/stylesheet/qss/coffee.qss @@ -59,6 +59,11 @@ QComboBox, QLineEdit, QSpinBox, QTextEdit, QListView { selection-background-color: #C19A6B; } +/* Make placeholder text a matching semi-transparent color */ +QComboBox, QLineEdit { + placeholder-text-color: #80C19A6B; +} + QListView { show-decoration-selected: 1; } |