Improve cannon example


- Store the box and sphere components for faster creation.
- Set 'collisionShapes' to the empty set when destroying the objects.
This is a hack to avoid the issue of the boxes exploding upon
recreation. The issue is that calling destroy on a qml object does not
delete it immediately so sometimes old boxes are left when the new
stacks are spawned leading to explosive collisions.

Pick-to: 6.5
Change-Id: Ia842d69d99470c641d9fb73b495d6c695f141b94
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
commitb84929e435f3ee0543270f7e2eb6c6e51c6d115d
parentc8ae51e2dfd83be4ac97033bc7dcf6585823d7a3
authorJonas Karlsson <jonas.karlsson@qt.io>
committerJonas Karlsson <jonas.karlsson@qt.io>
commit timeMon, 20 Feb 2023 12:21:56 +0100