PDA

View Full Version : Mask with validation



fernanddoluiz
28th October 2015, 18:12
This code doesn't work in Qt5.5

QString latMask = "([0-8][0-9]|90)" ;
QRegExp rLat(latMask + latMask);
ui.lineEdit->setValidator(new QRegExpValidator(rLat));
ui.lineEdit->setInputMask(QString::fromLatin1("00°00"));

jefftee
29th October 2015, 05:04
What doesn't work exactly? For starters, I doubt your regex does what you think it does and secondly, your input mask seems to be invalid. Haven't used myself, but the input mask characters supported are here (http://doc.qt.io/qt-5/qlineedit.html#inputMask-prop).

Why don't you show an example of what you consider valid input in the QLineEdit and any restrictions you want for that input data, etc.

fernanddoluiz
29th October 2015, 10:23
Only the mask works, but the validation doesn't works

jefftee
30th October 2015, 00:49
I'm afraid I can't help you if you don't provide the info I requested in my prior post. I'm sure your regex is not doing what you think it's doing, but without understanding what you consider valid input, I can't help.