Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. QRegExpValidator on Windows 10 / Qt 6.1.2
Forum Update on Monday, May 27th 2025

QRegExpValidator on Windows 10 / Qt 6.1.2

Scheduled Pinned Locked Moved Solved Qt 6
3 Posts 2 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • AxelViennaA Offline
    AxelViennaA Offline
    AxelVienna
    wrote on last edited by
    #1

    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

    C++ and Python walk into a bar. C++ reuses the first glass.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • AxelViennaA Offline
        AxelViennaA Offline
        AxelVienna
        wrote on last edited by
        #3

        OMG, I should have looked at the Compiler warnings.
        Solved -> thanks.

        C++ and Python walk into a bar. C++ reuses the first glass.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved