QMacStyle and QCocoaTheme: Fix selected item color for non-native menubar
Change-Id: I3b55e9ce896383338cf6ed768d912ca1835b7742 Task-number: QTBUG-28960 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
This commit is contained in:
parent
717ff94639
commit
8b94ceaff8
@ -143,6 +143,7 @@ static QMacPaletteMap mac_widget_colors[] = {
|
||||
QMacPaletteMap(QPlatformTheme::LabelPalette, kThemeTextColorPlacardActive, kThemeTextColorPlacardInactive),
|
||||
QMacPaletteMap(QPlatformTheme::GroupBoxPalette, kThemeTextColorPlacardActive, kThemeTextColorPlacardInactive),
|
||||
QMacPaletteMap(QPlatformTheme::MenuPalette, kThemeTextColorMenuItemActive, kThemeTextColorMenuItemDisabled),
|
||||
QMacPaletteMap(QPlatformTheme::MenuBarPalette, kThemeTextColorMenuItemActive, kThemeTextColorMenuItemDisabled),
|
||||
//### TODO: The zeros below gives white-on-black text.
|
||||
QMacPaletteMap(QPlatformTheme::TextEditPalette, 0, 0),
|
||||
QMacPaletteMap(QPlatformTheme::TextLineEditPalette, 0, 0),
|
||||
@ -167,7 +168,8 @@ QHash<QPlatformTheme::Palette, QPalette*> qt_mac_createRolePalettes()
|
||||
pal.setColor(QPalette::Disabled, QPalette::WindowText, qc);
|
||||
pal.setColor(QPalette::Disabled, QPalette::HighlightedText, qc);
|
||||
}
|
||||
if (mac_widget_colors[i].paletteRole == QPlatformTheme::MenuPalette) {
|
||||
if (mac_widget_colors[i].paletteRole == QPlatformTheme::MenuPalette
|
||||
|| mac_widget_colors[i].paletteRole == QPlatformTheme::MenuBarPalette) {
|
||||
qc = qt_mac_colorForTheme(kThemeBrushMenuBackground);
|
||||
pal.setBrush(QPalette::Background, qc);
|
||||
qc = qt_mac_colorForThemeTextColor(kThemeTextColorMenuItemActive);
|
||||
|
@ -4608,7 +4608,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
|
||||
HIRect menuRect = qt_hirectForQRect(mi->menuRect);
|
||||
HIRect itemRect = qt_hirectForQRect(mi->rect);
|
||||
|
||||
if ((opt->state & State_Selected) && (opt->state & State_Enabled) && (opt->state & State_Sunken)){
|
||||
const bool selected = (opt->state & State_Selected) && (opt->state & State_Enabled) && (opt->state & State_Sunken);
|
||||
if (selected) {
|
||||
// Draw a selected menu item background:
|
||||
HIThemeMenuItemDrawInfo mdi;
|
||||
mdi.version = qt_mac_hitheme_version;
|
||||
@ -4636,7 +4637,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
|
||||
Qt::AlignCenter | Qt::TextHideMnemonic | Qt::TextDontClip
|
||||
| Qt::TextSingleLine,
|
||||
mi->palette, mi->state & State_Enabled,
|
||||
mi->text, QPalette::ButtonText);
|
||||
mi->text, selected ? QPalette::HighlightedText : QPalette::ButtonText);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user