Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. German
  4. QLineEdit masked input

QLineEdit masked input

Scheduled Pinned Locked Moved Solved German
4 Posts 2 Posters 1.6k Views 2 Watching
  • 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.
  • G Offline
    G Offline
    Galilio
    wrote on last edited by A Former User
    #1

    Hallo Zusammen,

    bei einen QLineEdit möchte ich folgende Eingabeformat ermöglichen:
    EX1X wobei:
    E ist fix
    X1 variert sich von [A..Z]
    X sind 9 decimal Zahlen
    EX1X kann so z.B aussehen EB000000001
    Es muss bei der Eingabe darauf geachtet werden, dass nur dieses Format möglich ist.

    Danke

    1 Reply Last reply
    0
    • G Offline
      G Offline
      Galilio
      wrote on last edited by
      #2

      Lösung ist das:

      QRegExp format("[E][A-Z][0-9]+");
      QRegExpValidator *v = new QRegExpValidator(format);
      ui.lineEditEncoderName->setValidator(v);
      

      Danke

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

        Hallo,

        When du Qt 5 nutzt then solltest du QRegularExpression brauchen. QRegExp wird veraltet.

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

        G 1 Reply Last reply
        0
        • SGaistS SGaist

          Hallo,

          When du Qt 5 nutzt then solltest du QRegularExpression brauchen. QRegExp wird veraltet.

          G Offline
          G Offline
          Galilio
          wrote on last edited by
          #4

          @SGaist
          Danke
          Das stimmt :-)

          und so wird dann die Lösung nach Qt5:

          	QRegularExpression format("[E][A-Z][0-9]+"); //input maske festlegen
          	QValidator *v = new QRegularExpressionValidator(format);
          
          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