PDA

View Full Version : A less demanding rubberband wanted



bnilsson
18th February 2008, 21:50
When I pull the rubberband over a graphicsview that contains a lot of items, the items inside the rubberband are redrawn as I move the mouse, and this makes the rubberband get stuck mometarily.
How can I prevent this?
In simpler systems, a rubberband was just making a line box using 'reverse' draw mode twice, leaving the image behind it untouched. This would not require any usage of the scene data.
Is there a similar built-in function in Qt?
It is not clear to me how to do this 'manually'.

jpn
19th February 2008, 07:19
I suppose you could change the style of the rubberband widget.

Uwe
19th February 2008, 12:20
In simpler systems, a rubberband was just making a line box using 'reverse' draw mode twice, leaving the image behind it untouched. This would not require any usage of the scene data.
Is there a similar built-in function in Qt?
Painting in XOR mode is not possible in Qt4 anymore - one of substantial things, that are gone with the new graphics pipeline of Qt4.

The Trolls thought that modern hardware is ( or will be ) fast enough to do rubberbanding by repaints. On my low budget notebook early Qt4 releases were not and even today its sometimes tricky to get repaints fast enough for the rubberband.

Obviously the repaints of your scene are too slow and you need to find out how to speed them up.

Uwe

PS: You can try to use QwtPicker from the Qwt package. It implements a rubberband as a masked widget on top of your widget. But in the end your widget also needs to be fast enough to repaint the area below the previous position of the rubberband.

bnilsson
24th February 2008, 11:33
Ok, it seems this will be a showstopper for me using rubberband.
If I want to zoom in covering an area containing millions of items, it just won't work.
It looks more and more like I have to abandon Qt and go back to wxWidgets, as much as I would hate it.

wysota
24th February 2008, 13:07
Ok, it seems this will be a showstopper for me using rubberband.
If I want to zoom in covering an area containing millions of items, it just won't work.
You can manually turn off repainting for a short period of time. You can even grab a pixmap of your view and draw the pixmap instead of the items during rubberbanding. This way it'll be very fast. Once you release the mouse button, stop drawing the pixmap and let the graphics view handle the rest.

Gopala Krishna
24th February 2008, 13:58
You can manually turn off repainting for a short period of time. You can even grab a pixmap of your view and draw the pixmap instead of the items during rubberbanding. This way it'll be very fast. Once you release the mouse button, stop drawing the pixmap and let the graphics view handle the rest.

Where do you manage to get those witty ideas man ? :cool:

wysota
24th February 2008, 14:01
Where do you manage to get those witty ideas man ? :cool:

Deep space ;)