Hi guys!
I want to set validator on line edit.but it doesn't work.
my code is:
QRegExp rx("[0-9]{1,2}|24");
SlineEdit->setValidator(new QRegExpValidator(rx,SlineEdit));
which I want to set 0-24 available,but it doesn't work!![]()
Hi guys!
I want to set validator on line edit.but it doesn't work.
my code is:
QRegExp rx("[0-9]{1,2}|24");
SlineEdit->setValidator(new QRegExpValidator(rx,SlineEdit));
which I want to set 0-24 available,but it doesn't work!![]()
In your case, you can use QIntValidator.
And code snippet
Qt Code:
ui->lineEdit->setValidator( val );To copy to clipboard, switch view to plain text mode
Bookmarks