diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2020-04-27 15:28:10 +0200 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2020-04-29 07:13:57 +0200 |
commit | 15026f309b3c69b94de39e0cbeba09dd8bdd5e29 (patch) | |
tree | 1d11040b256ec53dcff9f3a08a786893544d77f1 /src/plugins/styles | |
parent | 5e8bd204e2af4fb53ef64c9e385223b52c26006e (diff) |
QMacStyle - change the arrow type only for 'OnlyOneTab' option
It appears the hack was not needed when we have several
tabs (popup button works as expected). Otherwise, this button
suddenly has a different size: it's bigger when selected and
smaller if not (and the holes clipped under the tab shape are
becoming quite visible in the dark mode to the left and right
of a tabbar). For the single tab we need some adjustment in
the size not to have visible difference between inactive/selected
tab.
Fixes: QTBUG-83216
Change-Id: I52511e610ae7b36f261e0218b7e432e747bc9491
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/plugins/styles')
-rw-r--r-- | src/plugins/styles/mac/qmacstyle_mac.mm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 8e4aaa19c7..84233d6521 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -3977,13 +3977,19 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // which makes no sense on tabs. NSPopUpArrowPosition oldPosition = NSPopUpArrowAtCenter; NSPopUpButtonCell *pbCell = nil; - if (isPopupButton) { + auto rAdjusted = r; + if (isPopupButton && tp == QStyleOptionTab::OnlyOneTab) { pbCell = static_cast<NSPopUpButtonCell *>(pb.cell); oldPosition = pbCell.arrowPosition; pbCell.arrowPosition = NSPopUpNoArrow; + if (pb.state == NSOffState) { + // NSPopUpButton in this state is smaller. + rAdjusted.origin.x -= 3; + rAdjusted.size.width += 6; + } } - [pb.cell drawBezelWithFrame:r inView:pb.superview]; + [pb.cell drawBezelWithFrame:rAdjusted inView:pb.superview]; if (pbCell) // Restore, we may reuse it for a ComboBox. pbCell.arrowPosition = oldPosition; |