roseicollis
15th May 2015, 09:57
Hi,
I have a LineEdit for a password which has to be numeric and max. lenght is 8. Also it has to display asterisks or dots as I see it does with my code. My problem is that if I put the next code when I write the 9th digit which should not let you to, it ERASES all the lineedit and writtes it as the first one. O.o Why do I have this behaviour?
QRegExp rx212("[0-9]{0,8}");
QValidator *validator212 = new QRegExpValidator(rx212, this);
// this both lines make it goes wrong
le_Pwd->setValidator(validator212); // this line alone allows me to put 0-8 numbers, no more. This is what I want but mask with ******
le_Pwd->setEchoMode(QLineEdit::Password); // this line alone allows me to show dots instead of numbers to mask the pwd. with no limit
Thank you!
I have a LineEdit for a password which has to be numeric and max. lenght is 8. Also it has to display asterisks or dots as I see it does with my code. My problem is that if I put the next code when I write the 9th digit which should not let you to, it ERASES all the lineedit and writtes it as the first one. O.o Why do I have this behaviour?
QRegExp rx212("[0-9]{0,8}");
QValidator *validator212 = new QRegExpValidator(rx212, this);
// this both lines make it goes wrong
le_Pwd->setValidator(validator212); // this line alone allows me to put 0-8 numbers, no more. This is what I want but mask with ******
le_Pwd->setEchoMode(QLineEdit::Password); // this line alone allows me to show dots instead of numbers to mask the pwd. with no limit
Thank you!