From 6df308c0d7170aec34423dfc129f6a13b425e960 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 12 Jan 2018 14:29:38 -0800 Subject: QMacStyle: Set WA_MacShowFocusRect for checkbox, radio button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes small and mini checkbox and radio button focus rings since the previous HITheme removal patch (90c9370d5098db95). But also allows to properly draw the focus ring outside the widget's boundaries, as it's common in macOS. More importantly, we pave the way to use QFocusFrame for most widgets and, eventually, implement the focus ring animation. Finally, we tweak the spacing between the indicators and their respective label. Change-Id: I4bf7ac1a06ce924a043f0365e487777d0b20a104 Reviewed-by: Tor Arne Vestbø --- src/widgets/widgets/qcheckbox.cpp | 1 + src/widgets/widgets/qradiobutton.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp index 235508535d..81bfd3af35 100644 --- a/src/widgets/widgets/qcheckbox.cpp +++ b/src/widgets/widgets/qcheckbox.cpp @@ -147,6 +147,7 @@ void QCheckBoxPrivate::init() q->setCheckable(true); q->setMouseTracking(true); q->setForegroundRole(QPalette::WindowText); + q->setAttribute(Qt::WA_MacShowFocusRect); setLayoutItemMargins(QStyle::SE_CheckBoxLayoutItem); } diff --git a/src/widgets/widgets/qradiobutton.cpp b/src/widgets/widgets/qradiobutton.cpp index dfba32d3e8..fd8922ed28 100644 --- a/src/widgets/widgets/qradiobutton.cpp +++ b/src/widgets/widgets/qradiobutton.cpp @@ -72,6 +72,7 @@ void QRadioButtonPrivate::init() q->setAutoExclusive(true); q->setMouseTracking(true); q->setForegroundRole(QPalette::WindowText); + q->setAttribute(Qt::WA_MacShowFocusRect); setLayoutItemMargins(QStyle::SE_RadioButtonLayoutItem); } -- cgit v1.2.3