QMacStyle - make focus ring less transparent

But only for the 'Light' theme. For "Dark" the system
color fits well (without our rather strange and random
0.5 we set for some reason).

Change-Id: Ic5c8372913515611a567090f82852ffc7ca14eb7
Fixes: QTBUG-74095
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Timur Pocheptsov 2019-03-18 16:21:26 +01:00
parent 66fc17eb5c
commit 4d77c37522

View File

@ -1227,11 +1227,17 @@ void QMacStylePrivate::drawFocusRing(QPainter *p, const QRectF &targetRect, int
Q_UNREACHABLE();
}
const auto focusRingColor = qt_mac_toQColor(NSColor.keyboardFocusIndicatorColor.CGColor);
auto focusRingColor = qt_mac_toQColor(NSColor.keyboardFocusIndicatorColor.CGColor);
if (!qt_mac_applicationIsInDarkMode()) {
// This color already has alpha ~ 0.25, this value is too small - the ring is
// very pale and nothing like the native one. 0.39 makes it better (not ideal
// anyway). The color seems to be correct in dark more without any modification.
focusRingColor.setAlphaF(0.39);
}
p->save();
p->setRenderHint(QPainter::Antialiasing);
p->setOpacity(0.5);
if (cw.type == SegmentedControl_First) {
// TODO Flip left-right
}