Widget.paint

Responsible for actually painting the widget to the screen. The clip rectangle and coordinate translation in the WidgetPainter are pre-configured so you can draw independently.

This function paints the entire widget, including styled borders, backgrounds, etc. You are also responsible for displaying any important active state to the user, including if you hold the active keyboard focus. If you only want to be responsible for the content while letting the style engine draw the rest, override paintContent instead.

paint is not called for system widgets as the OS library draws them instead.

More...
class Widget
void
paint

Detailed Description

The default implementation forwards to WidgetPainter.drawThemed, passing paintContent as the delegate. If you override this, you might use those same functions or you can do your own thing.

You should also look at WidgetPainter.visualTheme to be theme aware.

Meta

History

Prior to May 15, 2021, the default implementation was empty. Now, it is painter.drawThemed(&paintContent);. You may wish to override paintContent instead of paint to take advantage of the new styling engine.