diff options
author | Axel Spoerl <axel.spoerl@qt.io> | 2023-05-18 11:15:43 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2023-05-22 14:45:26 +0000 |
commit | 980a499ad0a4d30806d8c40e89b8d06419915a77 (patch) | |
tree | 20697c529bf5ccddce7c7bbf2034698bfbc254fb /tests/auto/widgets/styles/qstylesheetstyle | |
parent | 227b639499d7e9ebabd6e07e80f2c5c63a6a2154 (diff) |
Implement color role AccentColor in QStyleSheetStyle and QCssParser
The color role AccentColor has been added to QPalette.
This patch implements the new color role in QCssParser and subsequently
in QStyleSheetStyle.
The QBrush variable names used to populate brushes, have been changed
into speaking names for better code readability.
tst_QCssParser has been adapted accordingly.
The test function accentColor() has been added in tst_QStyleSheetStyle.
Documentation has been updated.
Change-Id: Ib09ddc1b61868f2bb8f70f654e83ea1c35276d30
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/widgets/styles/qstylesheetstyle')
-rw-r--r-- | tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index c36f3ada01..39a568008a 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -106,6 +106,7 @@ private slots: void QTBUG36933_brokenPseudoClassLookup(); void styleSheetChangeBeforePolish(); void placeholderColor(); + void accentColor(); void enumPropertySelector_data(); void enumPropertySelector(); //at the end because it mess with the style. @@ -2360,6 +2361,15 @@ void tst_QStyleSheetStyle::placeholderColor() QCOMPARE(le1.palette().placeholderText().color(), QColor(phSpec)); } +void tst_QStyleSheetStyle::accentColor() +{ + QLineEdit lineEdit; + const QColor universe(42, 42, 42); + lineEdit.setStyleSheet(QString("QLineEdit { accent-color: %1; }").arg(universe.name())); + lineEdit.ensurePolished(); + QCOMPARE(lineEdit.palette().accentColor().color(), universe); +} + void tst_QStyleSheetStyle::enumPropertySelector_data() { QTest::addColumn<QString>("styleSheet"); |