PDA

View Full Version : QLineEdit int type



nowire75
25th October 2007, 19:53
Hi,

I want to take only a integer value from a QLineEdit (32 bit int).
Can I use a QRegExp?


QRegExp regExp(" ...???.... ");
namedLineEdit[0]->setValidator(new QRegExpValidator(regExp, this));

Can someone help me?

nowire

jpn
25th October 2007, 19:59
You could use QIntValidator but I'd recommend using QSpinBox which is basically a specialized QLineEdit for numerical input and does it right(tm) in international applications. ;)