macOS 11: Fix positioning of focus frame around combobox
Fixes: QTBUG-94069 Change-Id: I09079726c96a41f628ae55724cfe53dbc225d358 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit df316963213e765de5b94469622df48b0c9a9e6e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
7668fdfde2
commit
a1cd0e8c08
@ -1149,6 +1149,8 @@ static QStyleHelper::WidgetSizePolicy qt_aqua_guess_size(const QWidget *widg, QS
|
||||
|
||||
void QMacStylePrivate::drawFocusRing(QPainter *p, const QRectF &targetRect, int hMargin, int vMargin, const CocoaControl &cw) const
|
||||
{
|
||||
const bool isBigSurOrAbove = QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSBigSur;
|
||||
|
||||
QPainterPath focusRingPath;
|
||||
focusRingPath.setFillRule(Qt::OddEvenFill);
|
||||
|
||||
@ -1198,7 +1200,6 @@ void QMacStylePrivate::drawFocusRing(QPainter *p, const QRectF &targetRect, int
|
||||
}
|
||||
case Button_PullDown:
|
||||
case Button_PushButton: {
|
||||
const bool isBigSurOrAbove = QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSBigSur;
|
||||
QRectF focusRect;
|
||||
auto *pb = static_cast<NSButton *>(cocoaControl(cw));
|
||||
const QRectF frameRect = cw.adjustedControlFrame(targetRect.adjusted(hMargin, vMargin, -hMargin, -vMargin));
|
||||
@ -1229,11 +1230,14 @@ void QMacStylePrivate::drawFocusRing(QPainter *p, const QRectF &targetRect, int
|
||||
}
|
||||
case Button_PopupButton:
|
||||
case SegmentedControl_Single: {
|
||||
QRectF focusRect = targetRect;
|
||||
if (isBigSurOrAbove)
|
||||
focusRect.translate(0, -1.5);
|
||||
const qreal innerRadius = cw.type == Button_PushButton ? 3 : 4;
|
||||
const qreal outerRadius = innerRadius + focusRingWidth;
|
||||
hOffset = targetRect.left();
|
||||
vOffset = targetRect.top();
|
||||
const auto innerRect = targetRect.translated(-targetRect.topLeft());
|
||||
hOffset = focusRect.left();
|
||||
vOffset = focusRect.top();
|
||||
const auto innerRect = focusRect.translated(-focusRect.topLeft());
|
||||
const auto outerRect = innerRect.adjusted(-hMargin, -vMargin, hMargin, vMargin);
|
||||
focusRingPath.addRoundedRect(innerRect, innerRadius, innerRadius);
|
||||
focusRingPath.addRoundedRect(outerRect, outerRadius, outerRadius);
|
||||
|
Loading…
x
Reference in New Issue
Block a user