How to paint the QLabel own within of paintEvent() in a subclass of QLabel before to start my custom painting actions?
I am creating an application that displays an image along with other widgets. To display the image use one QScrollArea and a custom subclass of QLabel .
In my subclass of QLabel I put the image (a QPixmap), but I also want to can highlight (draw) on QPixmap some figures (mainly rectangles representing the regions of interest).
For these reasons I am reimplementing the QWidget::paintEvent (QPaintEvent* event) function. The part of the function code that draws rectangles is already written, however I do not know how to (within the QWidget::paintEvent() and before I start drawing the rectangles) , draw the QLabel own (so that QPixmap is painted). Obviously, I been unable to paint the QLabel own, what I get in my application is an empty QScrollArea.
I do not know if there is a way (a function) to within QWidget::paintEvent() in a custom widget, the widget that is the parent class (in my case QLabel), is painted in the conventional manner and then proceed to the actions custom painted.
Personally, I like not having to paint the QLabel own in "low level" if it fits the term (ie, as shown in paintEvent() of the QLabel class) before I can make my own painting actions.
In short, the problem is that expressed in the title of this post:
How to paint the QLabel own within of paintEvent() in a subclass of QLabel before to start painting my custom actions?
Thanks in advance for any help and/or suggestions.
Why don't you make a custom widget containing a QLabel and in its paintEvent paint the QLabel highlight whichever area you want to?