Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.7.2, 4.8.4, 5.0.2
-
Ubuntu 11.04 x64, Qt SDK 4.7.2, g++ 4.5.2-8ubuntu4
Windows 7
Description
A it stands in documentation about QGraphicsItem::setZValue():
"If you restore the Z value, the item's insertion order will decide its stacking order."
But I noticed that if method setZValue() isn't called with proper value (so by default z=0) insertion ordering won't work properly.
I've called removeItem() and addItem() methods randomly and sometimes the stack order changes insertion order to its own random order.
Moreover, if QGraphicsScene uses BSP tree indexing algorithm it causes items flickering.
Pleas take a look on code inside my attachement. ( I'm sorry for a very ugly code but I's in hurry - however the problem is not in this code - I was testing this bug for whole day ).
and take a look on canvas.cpp file, line 113. If you comment this line you probably find that everything works OK. So for testing leave it uncommented.
Furthermore add path to some image file on your local dir in canvas.cpp line 226
Than follow these steps:
1. click right btn -> add item -> polygon
2. click on scene to add item.
3. add one more polygon and move it.
4. drag some image to the app.
5. remove first polygon
6. add new polygon.
7. drag second image.
On my computer I noticed that first image was moved to the bottom of the stack.