Nyaruko
Nyaruko

Reputation: 4459

How to move large amount of qgraphicsitem efficiently?

I have many qgraphicsitem which are waypoints on a map. And I would like to move them together. Thus I used a for loop to call their setPos() function. But when the items number become large (over 100). The move becomes slow... How could I make this more efficiently?

Upvotes: 2

Views: 518

Answers (1)

Drew McGowen
Drew McGowen

Reputation: 11706

If you're moving them all by the same amount, then you can use a QGraphicsItemGroup to group all of your waypoint items; then, you can simply move the item group to automatically move all the items in that group.

Upvotes: 4

Related Questions