From 769f68b19bc53a31582c4e3b7ca110661c0c8f4e Mon Sep 17 00:00:00 2001 From: Axel Spoerl Date: Fri, 8 Mar 2024 17:20:25 +0100 Subject: [PATCH] QGraphicsProxyWidget: use focus abstraction instead of focus_next/prev Focus abstraction in QWidgetPrivate makes direct access to QWidget::focus_next and focus_prev an antipattern. Remove usage. Task-number: QTBUG-121478 Change-Id: I741e6875e686a9cfb4e6a113e7575c911a38e80c Reviewed-by: Volker Hilsheimer --- src/widgets/graphicsview/qgraphicsproxywidget.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp index 6e9b91a378..1ff4814142 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp +++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp @@ -340,10 +340,10 @@ QWidget *QGraphicsProxyWidgetPrivate::findFocusChild(QWidget *child, bool next) // Run around the focus chain until we find a widget that can take tab focus. if (!child) { - child = next ? (QWidget *)widget : widget->d_func()->focus_prev; + child = next ? widget.data() : widget->previousInFocusChain(); } else { - child = next ? child->d_func()->focus_next : child->d_func()->focus_prev; - if ((next && child == widget) || (!next && child == widget->d_func()->focus_prev)) { + child = next ? child->nextInFocusChain() : child->previousInFocusChain(); + if ((next && child == widget) || (!next && child == widget->previousInFocusChain())) { return nullptr; } } @@ -360,8 +360,8 @@ QWidget *QGraphicsProxyWidgetPrivate::findFocusChild(QWidget *child, bool next) && !(child->d_func()->extra && child->d_func()->extra->focus_proxy)) { return child; } - child = next ? child->d_func()->focus_next : child->d_func()->focus_prev; - } while (child != oldChild && !(next && child == widget) && !(!next && child == widget->d_func()->focus_prev)); + child = next ? child->nextInFocusChain() : child->previousInFocusChain(); + } while (child != oldChild && !(next && child == widget) && !(!next && child == widget->previousInFocusChain())); return nullptr; }