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. Error when using Qlineedit setInputMask

Error when using Qlineedit setInputMask

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 487 Views 1 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.
  • F Offline
    F Offline
    Felipe Begot
    wrote on last edited by
    #1

    In my software, I set an input mask to a QlineEdit and it works fine unless I set the value using setText with a value that does not attend to the input mask restrictions. From that point on visually, the input mask does not work anymore.

    the input mask is: "^-?[0-9]+[.]{0,1}[0-9]{"x"}$
    x is the number of decimal digits allowed

    It is set a value like -0.XX. And the error occurs.

    Does anyone have any idea why that happens?

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

      Hi and welcome to devnet,

      Your input mask looks a bit fishy. It seems to be a regexp rather than an input mask. Is it the case ?

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

      F 2 Replies Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Your input mask looks a bit fishy. It seems to be a regexp rather than an input mask. Is it the case ?

        F Offline
        F Offline
        Felipe Begot
        wrote on last edited by
        #3

        @SGaist you are correct!

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi and welcome to devnet,

          Your input mask looks a bit fishy. It seems to be a regexp rather than an input mask. Is it the case ?

          F Offline
          F Offline
          Felipe Begot
          wrote on last edited by
          #4

          @SGaist it is used in the setValidator with the same expression.

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

            These are two different concepts which usually do not contain the same expressions because they are doing two different things.

            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
            1

            • Login

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