When a QIWidgetValidator instance is created it receives a pointer to a widget whose children should be checked for validity. The instance connects itself to signals emitted by input widgets when their contents changes, and emits its own signal, validityChanged() (common for all child widgets being observed), whenever the change happens.
Objects that want to know when the validity state changes should connect themselves to the validityChanged() signal and then use the isValid() method to determine whether all children are valid or not.
It is assumed that all children that require validity checks have been already added to the widget when it is passed to the QIWidgetValidator constructor. If other children (that need to be validated) are added later, it's necessary to call the rescan() method to rescan the widget hierarchy again, otherwise the results of validity checks are undefined.
It's also necessary to call the revalidate() method every time the enabled state of the child widget is changed, because QIWidgetValidator skips disabled widgets when it calculates the combined validity state.
This class is useful for example for QWizard dialogs, where a separate instance validates every page of the wizard that has children to validate, and the validityChanged() signal of every instance is connected to some signal of the QWizard subclass, that enables or disables the Next button, depending on the result of the validity check.
Currently, only QLineEdit and QComboBox classes and their successors are recognized by QIWidgetValidator. It uses the QLineEdit::hasAcceptableInput() and QCombobox::validator() methods to determine the validity state o the corresponding widgets (note that the QComboBox widget must be editable, otherwise it will be skipped).
|void||isValidRequested (QIWidgetValidator *aValidator)|
|void||validityChanged (const QIWidgetValidator *aValidator)|
Public Member Functions
|QString||caption () const|
|bool||isOtherValid () const|
|bool||isValid () const|
|QString||lastWarning () const|
|QIWidgetValidator (const QString &aCaption, QWidget *aWidget, QObject *aParent=0)|
|QIWidgetValidator (QWidget *aWidget, QObject *aParent=0)|
|void||setCaption (const QString &aCaption)|
|void||setLastWarning (const QString &aLastWarning)|
|void||setOtherValid (bool aValid)|
|QString||warningText () const|
|QWidget *||widget () const|
|QList< Watched >||mWatched|