I need to call several QWidget.update(rectangle) on the same widget, each time in a different or same rectangle. But the paint method needs more information, i.e. what to do in that rectangle. Highlight? Cursor? Fill? etc. So how do I pass the paintEvent() this extra information? [I am using PyQt, but an answer in Qt is fine also.]
I need to call several QWidget.update(rectangle) on the same widget, each time in a
Share
Here is a solution I’ve worked out for python:
Create several ‘paint’ methods, for example
paintAction1(self, event),paintAction2(self, event).Then, whenever you need a specific one, reassign the default
paintEventmethod to the correct one, for exampleself.paintEvent = self.paintAction1, etc. You can event create a default ‘paint’ method, and have each unusual one reassign ‘self.paintEvent’ back to the default one upon completion.