Isn't there a way to crop the rendering to only the affected part (commonly called "dirty" region)?
Areas of the QGraphicsView that are outside of the rubber band widget shouldn't be repainted at all.
In the paintEvent of your custom item you can retrieve the 'exposedRect' value from the parameter QStyleOptionGraphicsItem. It supposedly indicates the "dirty" area to be painted, but you need to set the proper item flag for this to happen:
http://doc.qt.io/qt-5/qstyleoptiongr...xposedRect-var
http://doc.qt.io/qt-5/qgraphicsitem.html#setFlag
Taken from: http://thesmithfam.org/blog/2007/02/...w-performance/ (Note it's for Qt 4.)Qt Code:
{ // Here comes the magic: painter->setClipRect( option->exposedRect ); // All your custom painting code goes here. // ... }To copy to clipboard, switch view to plain text mode
Bookmarks