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. The QLineEdit::setValidator can't stop QIntValidator Top Value when user input?

The QLineEdit::setValidator can't stop QIntValidator Top Value when user input?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 501 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.
  • X Offline
    X Offline
    Xiao Yang
    wrote on last edited by
    #1

    This is my code below.

        mValidator = new QIntValidator(0, 500, ui->lineEdit);
        mValidator->setRange(0, 500);
        ui->lineEdit->setValidator(mValidator);
    

    It works fine on Qt5.9.5. if user want to input "600", after user insert "60", the QLineEdit will stop user input continue.

    But this code will not work on Qt5.12.3, user can input the "999" in that QLineEdit.

    Is there a simple way to make Qt5.12.3 works same as Qt5.9.5?

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      See https://forum.qt.io/post/558433

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      X 1 Reply Last reply
      2
      • VRoninV VRonin

        See https://forum.qt.io/post/558433

        X Offline
        X Offline
        Xiao Yang
        wrote on last edited by
        #3

        @VRonin I read your links. And it works. Thank you very much.

        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