Don't create graphics nodes which will be deleted anyway


The old code first created the nodes, then checked whether their parent
element has the right type and deleted them if not.
Instead, first check the parent's type and only create the node if that
matches.

Pick-to: 6.10
Change-Id: Ib884ce486e76d8b8ac67a105a0235717d6a0c49c
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
commit80a8a108ffaeb1dbeedaca693274a222ba04aa1c
parent2831714161272d808dfbbc0197939fd2c234ba8c
authorRobert Löhning <robert.loehning@qt.io>
committerRobert Löhning <robert.loehning@qt.io>
commit timeWed, 8 Oct 2025 10:38:24 +0200