From cd446a7e250671c8994ee32395fe20a59d768466 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Wed, 12 Jan 2022 12:11:34 +0100 Subject: [PATCH] QMacStyle: fix a regression introduced by a button type change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø --- src/plugins/styles/mac/qmacstyle_mac.mm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 9d572486730..d395d1da63e 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -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