PDA

View Full Version : QWidget paintevent qustion



codeman
8th April 2012, 16:19
Hello friends,

is it possible to draw only changing rects in paintevent without loosing the rest of my unchanged paintings?


thx in adv

codeman

Lykurg
8th April 2012, 16:27
It depends on what exactly you are up to, but have a look at Qt::WA_OpaquePaintEvent.

codeman
8th April 2012, 16:33
Ok some details. I have subclass a widget and paint say 6 rects from top to bottom. so when I hover a specific rect region I update the icon of the rect.

And I want only paint this rect with the changed rect without loosing the other rect, where no changings are affected.

Lykurg
8th April 2012, 16:43
Ok, for that you could use Qt::WA_OpaquePaintEvent. Thus the image wont change. You have to calculate yourself which areas need an update. But be aware that calculating can cost much so that painting all could be faster. Also think about caching common parts using QPixmapCache.

codeman
8th April 2012, 19:24
Ok I try it thank you very much