Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QLineEdit with inputmask 9999;0
Forum Updated to NodeBB v4.3 + New Features

QLineEdit with inputmask 9999;0

Scheduled Pinned Locked Moved Unsolved General and Desktop
qlineditinputmask
4 Posts 2 Posters 1.9k 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.
  • B Offline
    B Offline
    BluTiGeS
    wrote on last edited by
    #1

    Hi all,

    I am currently looking into a QLineEdit behaviour if I have a input maks set to a lineEdit file which shall be used for a PIN entry.

    The problem is if the user only changes 2 digits out of the 4 the lineEdit->text() only returns the changed values and not the full string.

    How can I achieve it that i get the full string back also if nothing changed?

    So default value is 0000 but if I do a linEdit->text() it just returns a empty string.

    Am I missing something?

    Many Thanks

    Regards

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

      Hi,

      Yes, you missed a key point from the doc: The blank characters are always removed from the text after editing.

      You should add a validator to enforce the number of character entered before going further.

      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
      0
      • B Offline
        B Offline
        BluTiGeS
        wrote on last edited by
        #3

        Thank you SGaist, poining to it ;)

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

          You're welcome !

          I'd also recommend using _ as placeholder char rather than 0, otherwise people will think there's a default PIN or maybe no protection at all.

          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
          0

          • Login

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