Update item focus even if it doesn't have a canvas
authorBea Lam <bea.lam@nokia.com>
Thu, 15 Mar 2012 05:05:50 +0000 (15:05 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 20 Mar 2012 05:51:46 +0000 (06:51 +0100)
commitd268ac6f0e2642fc0f0bacab4f4a1f75b49ef1ec
tree7a352bea7f7ac032cb2043a0ec505e493fb6532f
parentd96d89c63c28f81f9c17666ed66222f523571f03
Update item focus even if it doesn't have a canvas

Currently the item focus data is not updated if it is not in a canvas.
This means a subFocusItem may be deleted when the item is outside of a
canvas, creating a stale pointer when the item is moved back into a
canvas.

This change also means that the last item to set focus=true will now
consistently get activeFocus. Previously if an item did not have a
canvas and then was moved back into the canvas, the first item found
with focus=true would get activeFocus.

Task-number: QTBUG-24616
Change-Id: Ia706bd6ba6bcbccd616b5019c7c0fae4c39afa7f
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
src/quick/items/qquickcanvas_p.h
src/quick/items/qquickitem.cpp
tests/auto/quick/qquickitem/tst_qquickitem.cpp