PDA

View Full Version : QGraphics view update : Help needed



kiranraj
3rd July 2007, 12:22
Hi,

I am stuck with some problem regarding GraphicsView update.

if drag the scroll bar on the right to move the viewing area up
and down directly to the area that I want to view, then the
display does not clean up the view first. There is some left-over
picture mixed with the new viewing area. If i drag the scroll
bar all the way to the top or all the way to the bottom, then you
will see some image left at the top edge or the bottom edge.
[ This is true only at the edges.

I have overrriden
void GraphicsScene:: scrollByContents(int dx, int dy)
{
scene()->update();
}

Thanx.

wysota
3rd July 2007, 12:26
Why did you override that method this way? You're not calling the default implementation. The code simply doesn't have any sense.

kiranraj
3rd July 2007, 12:37
Previously when ever i moved the scrollbars i used to get
previous picture mixed with the new viewing area. So i thought that scene is not updating
properly and reimplemented the scrollByContents method.

This solved the problem but iam still not getting the proper picture at the ends.

Gopala Krishna
3rd July 2007, 12:54
Looks like some of your items don't implement the boundingrect properly. Make sure you are not painting outside the bounding rect in your items.
Also are you implementing any item which changes its size ? If so make sure you also use prepareGeometryChange() berfore changing its bounding rect.
Ofcourse these are only gusses. If you show your code we might help in a better way :)

EDIT: BTW don't reimplement scrollByContents() if you don't want to change the default behaviour. Otherwise you might totally mess up the scrolling. :eek: