There is a method to set a validator to a QLineEdit:

void QLineEdit::setValidator(const QValidator *v)

Since the documentation does not contain many infos, I have some questions:

Is it safe to use the same Validator for more than one QLineEdit?
Qt Code:
  1. QDoubleValidator* doubleValidator = new QDoubleValidator(this);
  2. ui.edit1->setValidator(doubleValidator );
  3. ui.edit2->setValidator(doubleValidator );
  4. ui.edit3->setValidator(doubleValidator );
  5. ui.edit4->setValidator(doubleValidator );
To copy to clipboard, switch view to plain text mode 

I've read the sourcefile (qt 4.4.0) and saw that the QLineEdit class removes the const of the QValidator* v so it looks that the QLineEdit changes the validator...

Does an old validator gets deleted if I set a new one?
Qt Code:
  1. ui.edit1->setValidator( new QDoubleValidator(this) );
  2. ui.edit1->setValidator( new QDoubleValidator(this) );
To copy to clipboard, switch view to plain text mode 

Thanks