PDA

View Full Version : QGraphicsItem and setZValue problem with overlapping



T4ng10r
7th December 2009, 14:04
First I draw two big rectangle R1 and R2 inside which I draw two R3, R4 and R5, R6. Inside those smaller rectangles R3,R4,R5,R6 I draw few circles. This works well - it's done with parent/child hierarchy.

Now - I need to draw a line between circles being child of different big rectangles, but this line need to be hidden behind circles.
At the begin those lines were single independent objects. It didn't work.
Then I found info about Z Value and set this Z for each line as lets say 5, when circles had 10. It didn't work.
Then I add to scene one big QGraphicsWidget which isn't drawn, but its a parent for every item on scene. Still didn't work.
In meantime I changed Qt version from 2009.04 to 2009.05 hoping that new version may posses some new changes fixing this problem. Qt Assistant shows completely different description of how Z Value works.

One think that is left and could work - it to create two line-items, each as a child of different small rectangle (R3 and R5) and draw them that they would meet in the middle. But I don't like this solution.
Is there a way to draw this properly?