PDA

View Full Version : How to draw rubber band using XOR



lni
19th September 2009, 20:58
Hi,

I remember I can create rubber band of various shapes (not just line or rectangle) using XOR in Qt3, now in Qt4 we have QRubberBand, but it only provides line and rectangle shapes.

How can I create rubber band of various shapes (such as polygon, etc.) the same way as in Qt3?

I am using Qt Graphics View Framework...

Thanks

wysota
19th September 2009, 22:19
Using the same way - you can't, as drawing is only allowed in paint events. But you can draw a rubber band of any shape in general. Just do it during a proper event call (or use a dedicated graphics item).

Uwe
21st September 2009, 12:13
XOR mode has been reintroduced with Qt 4.5. So on platforms, where Qt::WA_PaintOutsidePaintEvent is supported ( X11) you can use it like with Qt3. On platforms like Windows you can post a dummy paint event, catch it using an event filter and paint there.

Uwe