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>
bb10
Axel Spoerl 2024-03-08 17:20:25 +01:00
parent 268fa11eef
commit 769f68b19b
1 changed files with 5 additions and 5 deletions

View File

@ -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;
}