PDA

View Full Version : paintEvent and overlay-graphics



maximAL
24th January 2008, 15:33
hi,
i'm trying to render an immoveable overlay graphics in the paintEvent(...) function of a QScrollArea.
unfortunately, only the requested region gets actually updated, so my overlay element mostly doest'n get redrawn and is moved with the other graphics.
is there a way to bypass this? or is it absolutely necessary to put the overlay element in an extra widget?

marcel
24th January 2008, 15:45
void QAbstractScrollArea::paintEvent ( QPaintEvent * event ) [virtual protected]
This event handler can be reimplemented in a subclass to receive paint events (passed in event), for the viewport() widget.
Note: If you open a painter, make sure to open it on the viewport().
Reimplemented from QWidget.

Did you do it like this?

maximAL
24th January 2008, 15:58
yes. as far as i understand, even when i draw outside the requested area, painting is clipped to it.
so when i scroll by 1 line, only this line will be updated and the rest will simply be scrolled.

aamer4yu
24th January 2008, 16:17
Why dont u try painting in the parent class ??
The scroll area must have some owner, and painting on that may give effect of overlay...
hope i am making sense :D