Display required fields

Is there a class to highlight the required fields in Qt? For C # there is ErrorProvider. Does Qt have something similar?

+4
source share
1 answer

In C # there is ErrorProvider. Does Qt have something similar?

Not that I knew.

Probably the easiest way is to use QWidget :: setStylesheet () to set the background (or something else) to highlight the desired fields.

Adding an icon next to a required field - a red asterisk, say - will be quite simple: create a Field class using a horizontal layout with a widget for the required field icon, a shortcut and a "field" widget, and give it the setRequired (bool) function.

I think you can also use QStyle to create a custom widget.

+2
source

All Articles