PDA

View Full Version : Regular expression



aguleo
25th January 2013, 15:00
In a Qt designer Form Class e have this lines in the constructor:


rx = new QRegExp("[0-9]{1,3}");
ui->lineEdit->setValidator(new QRegExpValidator (*rx, this));


Can i manage this same effect in a single line?

In a Qt designer Form Class e have this lines in the constructor:


rx = new QRegExp("[0-9]{1,3}");
ui->lineEdit->setValidator(new QRegExpValidator (*rx, this));


Can i manage this same effect in a single line?

Added after 4 minutes:

ops...

ui->lineEdit->setValidator(new QRegExpValidator (QRegExp("[0-9]{1,3}"), this));