Fix warning "item has already been added to this scene"

Review Request #127869 - Created May 8, 2016 and submitted

Martin Walch

When starting the game, exactly 8 identical warnings appear:

QGraphicsScene::addItem: item has already been added to this scene

Their origin lies in the ScoreSprite constructor which instantiates several QGraphicsTextItems, passing itself as parent. Afterwards each of them is explicitely added to the same scene as the ScoreSprite using scene->addItem. However, this is redundant because passing the ScoreSprite as parent already makes the new QGraphicsTextItems part of the same scene. Hence the warning.

Compiles fine.
Warnings do not appear any more at runtime.
Layout of UI looks unchanged.
Albert Astals Cid
Martin Walch
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted with commit 4b83d13101e8fce932d53c5cf4ccaa039085bc4f by Martin Walch to branch frameworks.