optimizing widget painting
I am painting a widget and I want to开发者_开发百科 optimize the process. Basically i will be sliding the image in the x direction and I only want to fill the newly exposed area. Is there a way to translate the pixels of a widget without calling update or using paintevent? I know of pixmaps and such but I am wondering If I can for example draw a pixmap once and then translate what I have drawn without having to paint anything else or draw pixmaps anymore.
in the widget constructor set the following property like so:
setAttribute(Qt::WA_OpaquePaintEvent,true);
then you can call widget.scroll(delta,0); from outside the paintevent()
you will need to find a way to paint that is outside of paintevent because there is no synchronism between the two and that would draw while the widget is scrolling which create artifacts....thaqt on x11 platform anyways.
精彩评论