QCocoaTheme: add ButtonText color to standard palette

The standard palette had no value set for ButtonText. The
result was the we drew button text in QtQuickControls2
using Text color instead, which would be wrong in dark
mode, and result in a dark color instead of white.

Note: Widgets hardcode the color "white" directly
in the mac style, and was not affected by the
missing value.

Fixes: QTBUG-89177
Pick-to: 6.2 6.1
Change-Id: Ie2d99bfac9fcc70d45e5bd40ea45becf3fd70d87
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Richard Moe Gustavsen 2021-08-19 11:17:03 +02:00
parent 587fe1a95a
commit b7150d22c8

View File

@ -99,7 +99,6 @@ static QPalette *qt_mac_createSystemPalette()
palette->setBrush(QPalette::Disabled, QPalette::WindowText, dark);
palette->setBrush(QPalette::Disabled, QPalette::Text, dark);
palette->setBrush(QPalette::Disabled, QPalette::ButtonText, dark);
palette->setBrush(QPalette::Disabled, QPalette::Base, backgroundBrush);
QBrush textBackgroundBrush = qt_mac_toQBrush([NSColor textBackgroundColor]);
palette->setBrush(QPalette::Active, QPalette::Base, textBackgroundBrush);
@ -124,6 +123,7 @@ static QPalette *qt_mac_createSystemPalette()
qc = qt_mac_toQColor([NSColor controlTextColor]);
palette->setColor(QPalette::Active, QPalette::Text, qc);
palette->setColor(QPalette::Active, QPalette::ButtonText, qc);
palette->setColor(QPalette::Active, QPalette::WindowText, qc);
palette->setColor(QPalette::Active, QPalette::HighlightedText, qc);
palette->setColor(QPalette::Inactive, QPalette::Text, qc);
@ -132,6 +132,7 @@ static QPalette *qt_mac_createSystemPalette()
qc = qt_mac_toQColor([NSColor disabledControlTextColor]);
palette->setColor(QPalette::Disabled, QPalette::Text, qc);
palette->setColor(QPalette::Disabled, QPalette::ButtonText, qc);
palette->setColor(QPalette::Disabled, QPalette::WindowText, qc);
palette->setColor(QPalette::Disabled, QPalette::HighlightedText, qc);