Does it matter if I check collision of a GraphicsItem to every other item in a scene or if I check collision of an item against the parent of these items?
Ex:
Option 1:
[...]
mainItem.collidesWithItem(generic1);
mainItem.collidesWithItem(generic2);
[...]
mainItem.collidesWithItem(generic30);
QGraphicsItem generic1;
QGraphicsItem generic2;
[...]
QGraphicsItem generic30;
QGraphicsItem mainItem;
mainItem.collidesWithItem(generic1);
mainItem.collidesWithItem(generic2);
[...]
mainItem.collidesWithItem(generic30);
To copy to clipboard, switch view to plain text mode
Option2:
[...]
mainItem.collidesWithItem(genericItemParent);
QGraphicsItem genericItemParent;
QGraphicsItem generic1.setParent(genericItemParent);
QGraphicsItem generic2.setParent(genericItemParent);
[...]
QGraphicsItem generic30.setParent(genericItemParent);
QGraphicsItem mainItem;
mainItem.collidesWithItem(genericItemParent);
To copy to clipboard, switch view to plain text mode
Which one is faster?
Bookmarks