From 86d973ed077b3e8e89571b2c3327f15d3ad89eed Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Sun, 17 Jul 2022 13:16:48 +0200 Subject: 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 --- src/plugins/styles/windowsvista/qwindowsvistastyle.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/plugins') 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(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")){ -- cgit v1.2.3