QRegExpValidator on Windows 10 / Qt 6.1.2
-
I am developing a Qt based user interface which is compiled both on Linux and Windows 10 / MinGW.
The project requires me to use Qt 5.15.2 on Linux and Qt 6.1.2 on Windows 10, which works fine with some tweaks in the .pro file.I get stuck with QRegExpValidator on the Windows compile server:
ui->serialNumber->setValidator(new QRegExpValidator(QRegExp("[1-9][0-9]*"), this));
...compiles just fine on Linux/Qt 5.15.2 and causes Windows 10 / MinGW with Qt 6.1.2 to say
unknown type name 'QRegExpValidator'
.I expected that
QT+=core5compat
in my .pro file would take care of the issue, but it does not.
For sure I have overlooked something, but I don't find it. Windows and I are not so close...
Thanks in advance for helping me a hand.
Axel -
Hi,
Please change to QRegularExpressionValidator. The QRegExp related classes were already deprecated in Qt 5.
In the code snippet you show, you can really just swap the two classes.
-
OMG, I should have looked at the Compiler warnings.
Solved -> thanks.