View Full Version : validator on line edit
Raul
27th August 2010, 05:02
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!:confused:
saa7_go
27th August 2010, 05:08
In your case, you can use QIntValidator (http://doc.trolltech.com/4.6/qintvalidator.html).
Talei
27th August 2010, 05:10
And code snippet
QValidator *val = new QIntValidator(0, 24, this);
ui->lineEdit->setValidator( val );
Raul
27th August 2010, 05:18
And code snippet
QValidator *val = new QIntValidator(0, 24, this);
ui->lineEdit->setValidator( val );
this method i know,i just want to use QRegExp rx("[0-9]{1,2}|24") syntax.thank you all the same!
Raul
27th August 2010, 05:18
In your case, you can use QIntValidator (http://doc.trolltech.com/4.6/qintvalidator.html).
this method i know,i just want to use QRegExp rx("[0-9]{1,2}|24") syntax.thank you all the same!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.