QMacStyle: fix a regression introduced by a button type change

Since we (re)use NSButton to render tab items, the 'momentary push in'
button type breaks the tab. Temporary restore the old 'push on/push off'
type if rendering a tab.

Pick-to: 6.2 6.3 5.15
Fixes: QTBUG-99743
Change-Id: I54b11c1a35373292ecf0bcd5cf7b4ea4203cc031
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Timur Pocheptsov 2022-01-12 12:11:34 +01:00
parent c30af31f99
commit cd446a7e25

View File

@ -3963,6 +3963,13 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
}
pb.frame = frameRect.toCGRect();
if (!isPopupButton) {
// Note: these days we use 'momentary push in' for Button_PushButton,
// but tabs are also rendered using NSButton/ButtonPushButton, and
// here we need 'push on/off' to make it work (tab highlight colors).
pb.buttonType = NSButtonTypePushOnPushOff;
}
pb.enabled = isEnabled;
[pb highlight:isPressed];
// Set off state when inactive. See needsInactiveHack for when it's selected