qt5base-lts/tests/auto/widgets/kernel
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
..
qaction testlib: add key sequence function 2017-06-22 07:56:18 +00:00
qactiongroup Updated license headers 2016-01-21 18:55:18 +00:00
qapplication Convert features.wheelevent to QT_CONFIG 2017-06-28 16:15:09 +00:00
qboxlayout Merge remote-tracking branch 'origin/5.6' into 5.7 2016-09-28 11:51:35 +02:00
qdesktopwidget Updated license headers 2016-01-21 18:55:18 +00:00
qformlayout QFormLayout: take the correct row in takeRow() 2017-02-08 11:01:31 +00:00
qgesturerecognizer Move QGestureRecognizer test to widgets/kernel 2017-06-02 18:36:11 +00:00
qgridlayout Merge remote-tracking branch 'origin/5.7' into 5.8 2016-09-29 00:38:01 +02:00
qlayout tests/auto/widgets: use QCOMPARE(., nullptr) 2016-11-30 07:24:47 +00:00
qshortcut Deprecate QString::null 2017-03-12 17:41:16 +00:00
qsizepolicy QSizePolicy: inline toControlTypeFieldValue() 2017-02-27 23:09:27 +00:00
qstackedlayout Plug memleaks in tst_QStackedLayout 2017-01-14 18:17:47 +00:00
qtooltip Updated license headers 2016-01-21 18:55:18 +00:00
qwidget Widgets: be able to tab to a widget that has a focus proxy 2017-09-25 07:18:37 +00:00
qwidget_window Merge remote-tracking branch 'origin/5.9' into dev 2017-08-31 14:31:31 +02:00
qwidgetaction Updated license headers 2016-01-21 18:55:18 +00:00
qwidgetmetatype Updated license headers 2016-01-21 18:55:18 +00:00
qwidgetsvariant Updated license headers 2016-01-21 18:55:18 +00:00
qwindowcontainer Make QPlatformSurface events work with QWindowContainer 2017-02-27 12:38:08 +00:00
kernel.pro Move QGestureRecognizer test to widgets/kernel 2017-06-02 18:36:11 +00:00