summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@qt.io>2018-03-19 13:15:00 -0700
committerGabriel de Dietrich <gabriel.dedietrich@qt.io>2018-03-22 21:25:24 +0000
commitfae42e1e73edd2aa18ec257933d856a1d88337a7 (patch)
tree2e176de8e945e1e7eadce42cc6a2145131c66f87
parentb8dc00ea4bf50fef22eaca163b78ae408530ae55 (diff)
QMacStyle: Don't highlight square buttons text when pressed
Native square buttons keep their text black when pressed or on. Plus using the QStyleOptionButton variable over the QStyleOption one where appropriate. Change-Id: Idba8197e64d408e8a0987f1ef9243fde08e3e839 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index 15ffd4853a..043a910a7c 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -3958,8 +3958,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
// takes precedence over a normal default button
if ((btn->features & QStyleOptionButton::AutoDefaultButton)
&& isActive && hasFocus)
- d->autoDefaultButton = opt->styleObject;
- else if (d->autoDefaultButton == opt->styleObject)
+ d->autoDefaultButton = btn->styleObject;
+ else if (d->autoDefaultButton == btn->styleObject)
d->autoDefaultButton = nullptr;
const bool isEnabled = btn->state & State_Enabled;
@@ -3971,7 +3971,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
&& d->autoDefaultButton == btn->styleObject));
const bool hasMenu = btn->features & QStyleOptionButton::HasMenu;
const auto ct = cocoaControlType(btn, w);
- const auto cs = d->effectiveAquaSizeConstrain(opt, w);
+ const auto cs = d->effectiveAquaSizeConstrain(btn, w);
const auto cw = QMacStylePrivate::CocoaControl(ct, cs);
auto *pb = static_cast<NSButton *>(d->cocoaControl(cw));
// Ensure same size and location as we used to have with HITheme.
@@ -4041,7 +4041,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
const bool isActive = btn.state & State_Active;
const bool isPressed = btn.state & State_Sunken;
- if (!hasMenu) {
+ const auto ct = cocoaControlType(&btn, w);
+
+ if (!hasMenu && ct != QMacStylePrivate::Button_SquareButton) {
if (isPressed
|| (isActive
&& ((btn.features & QStyleOptionButton::DefaultButton && !d->autoDefaultButton)