Performance benefit of update() vs update(QRect) on QPixmap
-
Calling
update
with a region makes the subsequentpaintEvent
be limited to at least that region; any paints outside the event's region won't have any effect (though the widget can still make them). Whether that has performance benefits depends on the widget's implementation really; the QPainter calls themselves are relatively cheap, it is mostly about if it can avoid making any expensive calculations (text shaping, or iterating over large internal structures, etc) by being aware of the event bounding rectangle.If the widget is just painting a pixmap over its' entire content area, I personally wouldn't care much. I mean, sure, if it is easy for you to determine a smaller relevant region to update when you request an update then it certainly won't hurt, but it will also probably not help too much.
-
Calling
update
with a region makes the subsequentpaintEvent
be limited to at least that region; any paints outside the event's region won't have any effect (though the widget can still make them). Whether that has performance benefits depends on the widget's implementation really; the QPainter calls themselves are relatively cheap, it is mostly about if it can avoid making any expensive calculations (text shaping, or iterating over large internal structures, etc) by being aware of the event bounding rectangle.If the widget is just painting a pixmap over its' entire content area, I personally wouldn't care much. I mean, sure, if it is easy for you to determine a smaller relevant region to update when you request an update then it certainly won't hurt, but it will also probably not help too much.
-
Calling
update
with a region makes the subsequentpaintEvent
be limited to at least that region; any paints outside the event's region won't have any effect (though the widget can still make them). Whether that has performance benefits depends on the widget's implementation really; the QPainter calls themselves are relatively cheap, it is mostly about if it can avoid making any expensive calculations (text shaping, or iterating over large internal structures, etc) by being aware of the event bounding rectangle.If the widget is just painting a pixmap over its' entire content area, I personally wouldn't care much. I mean, sure, if it is easy for you to determine a smaller relevant region to update when you request an update then it certainly won't hurt, but it will also probably not help too much.
-