PDA

View Full Version : QGraphicsItem disapper when scrolling



bamdenied
14th February 2017, 11:35
Dear Community,

when I scroll on my QGraphicsScene, the added QGraphicsItems disappear.
I don't know why this happens.
I have overwritten the boundingRect() method and made sure that the Item is only drawing inside its boundingRect.

Is it possible that overlapping of different boundingRects produce this issue?

Does anybody have an idea why this happens?

Have a look at the attached screenshots.

Thanks a lot in advance!

Best Regards
Mark


123321233312334

d_stranz
14th February 2017, 19:01
If your objects have overlapping rects with different Z-orders, and you are filling / clearing those rects with a white background color, then you could see those effects.

What happens in your third image (with bounding rects drawn) when your scroll bars are active? Is the entire object drawn?

bamdenied
16th February 2017, 12:00
I have no different Z-orders and I only draw the visable lines inside the bounding rect.
In my opinion this happens because Qt thinks the Item (Line) isn't in the visible part of the scene.
Therefore Qt decides to do not paint the whole item anymore.
But why could that happen?