Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    LineEdit write only number

    General and Desktop
    3
    3
    661
    Loading More Posts
    • 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.
    • R
      Roby last edited by

      Help please

      I few months ago this code worked (I could only enter the numbers) but now it does not work

      @
      QRegExp exp ("[1-9.1]{100}");
      ui->lineEdit->setValidator(new QRegExpValidator(exp,this));
      @

      Help me please

      [edit: added missing coding tags @ SGaist]

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi and welcome to devnet,

        That's not really a Qt question but anyway: your regexp looks wrong. You are asking for your user to enter exactly 100 time something containing [1-9.1]

        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 Reply Quote 0
        • D
          DBoosalis last edited by

          How about [0-9]+

          1 Reply Last reply Reply Quote 0
          • First post
            Last post