Q: Qt - [c++] QDialog gets repainted when overlay dialog closes
-
Hello Qt Forum!
I am manually drawing a background (with lines and polygons) on a dialog, which is rendered at the paintEvent(QPaintEvent *) method.
Then, an additional dialog is shown, partially overlying on the background-dialog.
Whenever such an overlay-dialog closes, the background dialog gets fully visible, and redraws all the background (with hundrets of polygons) again.This causes a delay when showing, hiding overlay dialogs.
Is there a possibility, to 'cache' the drawn background area, so it needs to be rendered only once?
If i suppress all following paintEvents, all the manually painting gets lost and the dialog only shows the background color ...
Thanks, cheers, kevind_d
-
When the os asks to redraw something you have to do it - noone is doing caching here (how should it work though - how should someone except you know that nothing has changed in between)
The only way I see is to cache the whole painting in a QImage and only draw the QImage in paintEvent() -