qt6-bb10/tests/auto/widgets
Volker Hilsheimer 71b3d18ea7 Notify about focus object changes upon widget destruction
If the active QWidget gets destroyed, then QWidgetWindow::focusObject
will return nullptr. If then no other object takes focus, then we'd
never emit change signals, and QGuiApplication's _q_updateFocusObject
(which then informs the input context and emits signals) didn't get
called. This left the input context with a dangling focus object
pointer, which resulted in crashes.

If the QWidget clears its focus, but the corresponding window doesn't
know that it had focus, then fall back to the widget's focus widget
to see if we have a change in focus, so that signals get emitted.

Add a test case that shows that we didn't call _q_updateFocusObject
by counting emissions of the QGuiApplication::focusObjectChanged
signal, which we emit in this function. The signal is emitted more
than once both when showing a widget, and now also when destroying
a widget that has a focus child. The former is a previous issue,
the latter is an improvement to not emitting the signal at all.

Pick-to: 6.3 6.2
Fixes: QTBUG-101423
Fixes: QTBUG-101321
Change-Id: Ib96a397211d442f52ce795a3eebd055a0ef51b0d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-25 17:04:37 +01:00
..
dialogs Tests: Do not depend on transitive includes 2022-03-17 17:14:37 +01:00
effects Fix tst_qgraphicseffect on Wayland 2021-03-11 08:04:21 +01:00
graphicsview Android: Blacklist failing tests on tst_QGraphicsProxyWidget 2022-03-22 17:49:05 +02:00
itemviews QAbstractItemView: with single selection, deselect on Ctrl+Release 2022-03-24 00:42:00 +01:00
kernel Notify about focus object changes upon widget destruction 2022-03-25 17:04:37 +01:00
styles QStyle: Fix cases when logicalValue is outside range 2022-03-10 12:39:11 +01:00
util Position QCompleter popup based on the widget's screen geometry 2022-02-15 01:28:30 +00:00
widgets Fix compiler warnings in tests 2022-03-24 13:23:16 +01:00
CMakeLists.txt