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"));
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"));
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.
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.
I write the best type of code possible, code that I want to write, not code that someone tells me to write!
Only the mask works, but the validation doesn't works
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.
I write the best type of code possible, code that I want to write, not code that someone tells me to write!
Bookmarks