From 43ce457cbd093fc06d99b5ac833c789ef7c893d5 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 14 Jan 2024 17:50:39 +0100 Subject: Widgets: pass widget to QStyle::pixelMetric() Make sure to pass the widget to QStyle::pixelMetric() as some styles might use this (e.g. the new windows styles) to determine the correct pixel metric. Pick-to: 6.7 6.6 6.5 6.2 Task-number: QTBUG-1857 Change-Id: I5c32f5af8b284749732b610e56b4e3d8c8ed1946 Reviewed-by: Axel Spoerl Reviewed-by: David Faure --- src/widgets/widgets/qfocusframe.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/widgets/widgets/qfocusframe.cpp') diff --git a/src/widgets/widgets/qfocusframe.cpp b/src/widgets/widgets/qfocusframe.cpp index 396f7fca14..d66faedbac 100644 --- a/src/widgets/widgets/qfocusframe.cpp +++ b/src/widgets/widgets/qfocusframe.cpp @@ -52,8 +52,8 @@ void QFocusFramePrivate::updateSize() QStyleOption opt; q->initStyleOption(&opt); - int vmargin = q->style()->pixelMetric(QStyle::PM_FocusFrameVMargin, &opt), - hmargin = q->style()->pixelMetric(QStyle::PM_FocusFrameHMargin, &opt); + int vmargin = q->style()->pixelMetric(QStyle::PM_FocusFrameVMargin, &opt, q), + hmargin = q->style()->pixelMetric(QStyle::PM_FocusFrameHMargin, &opt, q); QPoint pos(widget->x(), widget->y()); if (q->parentWidget() != widget->parentWidget()) pos = widget->parentWidget()->mapTo(q->parentWidget(), pos); @@ -229,8 +229,8 @@ QFocusFrame::paintEvent(QPaintEvent *) QStylePainter p(this); QStyleOption option; initStyleOption(&option); - const int vmargin = style()->pixelMetric(QStyle::PM_FocusFrameVMargin, &option); - const int hmargin = style()->pixelMetric(QStyle::PM_FocusFrameHMargin, &option); + const int vmargin = style()->pixelMetric(QStyle::PM_FocusFrameVMargin, &option, this); + const int hmargin = style()->pixelMetric(QStyle::PM_FocusFrameHMargin, &option, this); QWidgetPrivate *wd = qt_widget_private(d->widget); QRect rect = wd->clipRect().adjusted(0, 0, hmargin*2, vmargin*2); p.setClipRect(rect); -- cgit v1.2.3