Is there an "aggregate" version of QValidator?
-
I'm thinking of something vaguely analogous to QButtonGroup, which aggregates logically related (not necessarily spatially proximate) QButtons and provides global features like exclusiveness and id's. Suppose I have a collection of input-like controls (check boxes, radio button, QLineEdit, spinners and such) and I want to run code to validate the whole collection, which might have mutual dependencies. I realize I could just use multiple separate QValidators and/or implement some validate() method, but I'd like to know if there is a (maybe 3rd party) library which covers these cases in a systematic way. Something like a "QValidatorGroup" base class that could be subclassed with a concrete validate() implementation and have its own signals, slots, and properties as appropriate? That seems more efficient than recreating the relevant functionally ad-hoc for each QDialog or QMainWindow which has some notion of aggregate validation.
-
Hi,
I am not aware of such a control but you description made me think of QWizardPage.
You register your fields, if all mandatory fields have been field, the isComplete function will return true so QWizard can enabled/disable the next/finish buttons based on that.It sounds like you want something a bit similar.
-
The idea of the QValidator is to validate while you are typing/changing the value. If you just want to validate at the end (not while things are changed), then you can just write a function that goes over all the widgets.
I remember a talk by an Adobe employee that was about something similar. AI tells me the speaker is Sean Parent and the library is Adam (a.k.a the Property Model Library or PML) which is part of the Adobe Source Libraries (ASL). Maybe you can find it and adapt some of their ideas. It is not explicitly written for Qt and might not work with it out of the box.
-
you can put a QMap of validators/input widgets and signal every input change to slot that checks the inputs for validity. you could sub-class all items to emit a same signal to indicate input change, that would allow to put them in some validity checker. or if the ::event stuff allows it better