Ensure subfocus is not reset to 0 when hiding a panel. 2705
authorAndreas Aardal Hanssen <andrhans@cisco.com>
Fri, 21 Oct 2011 06:33:40 +0000 (08:33 +0200)
committerAndreas Aardal Hanssen <andreas.hanssen@tandberg.com>
Fri, 21 Oct 2011 10:06:16 +0000 (12:06 +0200)
commit07e1f649716783d0097ee1db910990ea11bfb9a7
treee695f41a1c02df97356749a7c3ae7258e0801c59
parent7aba43a71384ea39d10204f447371977012c4363
Ensure subfocus is not reset to 0 when hiding a panel.

When hiding any widget that is not a panel, it is correct to clear
subfocus. In case clearFocus() has been called, the result is that
focusItem() / focusWidget() points to 0, which is correct. Upon
reactivation, nothing gains input focus. When changing focus, the
following setSubFocus() call will ensure subfocus points to the new
widget.

When hiding a panel, however, it's essential that subfocus within
that panel is not cleared, otherwise, when re-showing the panel,
nothing will have focus, whereas the expected behavior is that focus
is restored to the last item that had focus, i.e., the focusItem()
a.k.a. subfocus widget.

Task-number: QTBUG-22256
Reviewed-by: James PerrettĀ <jamperre@cisco.com>
src/gui/graphicsview/qgraphicsitem.cpp
src/gui/graphicsview/qgraphicsitem_p.h
tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp