qt5base-lts/tests/auto/widgets
Richard Moe Gustavsen 0dbede2b17 Widgets: be able to tab to a widget that has a focus proxy
When tabbing/searching for the next focus widget, the current
code would check if the next widget in the focus chain
had a focus proxy, and if so, ignore it. The exact reason
for this behavior is not clearly understood, but some widgets
(e.g QSpinBox) has children (a QLineEdit) that sets the parent
as focus proxy. If we didn't ignore children with focus proxy, tabbing
from a QSpinBox would lead us to find the inner QLineEdit, which
(because of its proxy), would lead us back to the QSpinBox. And
therefore not be able to tab out.

But ignoring the focus proxy has other problems. Normally a focus
proxy is the next sibling to the widget it acts as a proxy for, and
tabbing to the widget will therefore appear correct. But if the
focus proxy is not the next sibling, the logic will fail, since
the tab would anyway give focus to the next sibling. This becomes very
apparent if the focus proxy is a child of the widget, since then
its likely that the focus proxy is not the _first_ child among all
the children. So tabbing to the parent would not give focus to
the proxy.

This patch will change this logic so that you are allowed to tab to a
widget with a focus proxy. But we check that if you do so, you actually
end up moving focus in the right direction. If not, we ignore it like
before. This will ensure that we tab correctly when dealing with focus
proxies, and especially when focus proxies are used to construct
compound widgets.

[ChangeLog][Widgets] When tabbing to a widget with focus proxy, focus
will now be given to the proxy rather than just being ignored.

Task-number: QTBUG-10907
Change-Id: I66d1da5c941fdd984bb2783cc355ca65b553b5dd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-09-25 07:18:37 +00:00
..
dialogs Merge remote-tracking branch 'origin/5.9' into 5.10 2017-09-20 11:58:32 +02:00
effects Revert "QWidgetEffectSourcePrivate::draw(): Call render() when no shared painter exists" 2017-06-14 13:00:35 +00:00
graphicsview Blacklist tst_QGraphicsScene::isActive in openSUSE 42.3 2017-09-20 09:48:36 +00:00
itemviews Blacklist tst_QItemDelegate::enterKey tests on openSUSE 42.3 2017-09-22 14:34:30 +00:00
kernel Widgets: be able to tab to a widget that has a focus proxy 2017-09-25 07:18:37 +00:00
styles Merge remote-tracking branch 'origin/5.9' into dev 2017-08-02 22:52:32 +02:00
util Convert features.filesystemmodel to QT_[REQUIRE_]CONFIG 2017-07-02 10:39:04 +00:00
widgets Merge remote-tracking branch 'origin/5.9' into 5.10 2017-09-06 13:26:31 +02:00
widgets.pro Move QGestureRecognizer test to widgets/kernel 2017-06-02 18:36:11 +00:00