diff options
author | Axel Spoerl <axel.spoerl@qt.io> | 2024-03-08 17:20:25 +0100 |
---|---|---|
committer | Axel Spoerl <axel.spoerl@qt.io> | 2024-03-18 17:21:22 +0100 |
commit | 769f68b19bc53a31582c4e3b7ca110661c0c8f4e (patch) | |
tree | a45a1fde240a0249935deebc613b43cb5f19de11 | |
parent | 268fa11eef8834f752a0369a467aa0269a509c8b (diff) |
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 <volker.hilsheimer@qt.io>
-rw-r--r-- | src/widgets/graphicsview/qgraphicsproxywidget.cpp | 10 |
1 files 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; } |