How to set validator for all lineEdit in application ?
My application has 90 lineEdit widget. I want to set QDoubleValidator for every lineEdit.
So how can I do that ? I can set individual I mean something like:
But I want to set 90 lineEdits validator at once...
You can subclass QLineEdit and create your own custom lineEdit class, then set the validator inside your custom class and use it whereever its needed.
if you really have to do it at all at once and not as sam suggested you could do the following (for each widget without a parent):
foreach(QLineEdit* lineEdit, mainWindow.findChildren<QLineEdit*>() )
If you only want to have doubles there, why not use "QDoubleSpinBox":http://qt-project.org/doc/qt-4.8/qdoublespinbox.html instead?