ui->lineEdit_R1->setValidator(new QDoubleValidator(-999.0,999.0, 2, this));
C++ (Qt)class ValidatableLineEdit : public QLineEdit{public: ValidatableLineEdit(QWidget *parent = 0) : QLineEdit(parent) { setValidator(new QDoubleValidator(-999.0, 999.0, 2, this)); }};