tags:

views:

94

answers:

1

Is there any class for highlighting required fields in Qt? For C# there's ErrorProvider. Does Qt has anything similar?

+1  A: 

For C# there's ErrorProvider. Does Qt has anything similar?

Not that I'm aware of.

Probably the easiest way is to use QWidget::setStylesheet() to set a background (or whatever) to highlight the required fields.

Adding an icon next to the required field -- a red asterisk, say -- would be fairly straightforward: create a Field class using a horizontal layout with a required-field icon widget, a label and a 'field' widget, and give it a setRequired(bool) function.

I guess you could also use QStyle to create a custom widget.

Sam Dutton