diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-07-17 13:16:48 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-07-19 05:12:33 +0200 |
commit | 86d973ed077b3e8e89571b2c3327f15d3ad89eed (patch) | |
tree | 7328335f9a6f8972a7fa74ba5967d1ef9977d390 /src/plugins/styles | |
parent | 6b2cc49580bab245e970d5162207fb0086a2750c (diff) |
QCommandLinkButton: Let the style set the text colors
Make the hack less hacky by letting the style polish the widget (it does
already for the font) to set a dynamic property that the button can
test. Use the available palette entires ButtonText and BrightText to set
the dark blue and bright blue colors, rather than hardcoding them in the
widget code.
Pick-to: 6.4
Change-Id: Idfb3b7d18e456a9d14af4962cf723e12ff1c3370
Reviewed-by: Doris Verria <doris.verria@qt.io>
Diffstat (limited to 'src/plugins/styles')
-rw-r--r-- | src/plugins/styles/windowsvista/qwindowsvistastyle.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp index e15a19f9c1..0380ef82d8 100644 --- a/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp @@ -2263,9 +2263,14 @@ void QWindowsVistaStyle::polish(QWidget *widget) widget->setAttribute(Qt::WA_Hover); #if QT_CONFIG(commandlinkbutton) else if (qobject_cast<QCommandLinkButton*>(widget)) { + widget->setProperty("_qt_usingVistaStyle", true); QFont buttonFont = widget->font(); buttonFont.setFamilies(QStringList{QLatin1String("Segoe UI")}); widget->setFont(buttonFont); + QPalette pal = widget->palette(); + pal.setColor(QPalette::ButtonText, QColor(21, 28, 85)); + pal.setColor(QPalette::BrightText, QColor(7, 64, 229)); + widget->setPalette(pal); } #endif // QT_CONFIG(commandlinkbutton) else if (widget->inherits("QTipLabel")){ |