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. Issue with the QDoubleValidator
Qt 6.11 is out! See what's new in the release blog

Issue with the QDoubleValidator

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 549 Views
  • 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.
  • S Offline
    S Offline
    Shruthi
    wrote on last edited by
    #1

    Hi Everyone,

    I am validating the line edit in the qt. Below is the code for it.
    ui->lineEdit_1->setValidator(new QDoubleValidator(0, 10000.0, 2));

    I am using the double validator for validating the lineEdit_1 field.
    But In the GUI it is taking character "e".
    But not all the alphabets, it takes only character "e".
    May be it is considering as exponential "e" I am not understanding.

    Please let me know how to get rid off this.

    Suggestions are appreciated.

    Thank you.

    JonBJ 1 Reply Last reply
    0
    • S Shruthi

      Hi Everyone,

      I am validating the line edit in the qt. Below is the code for it.
      ui->lineEdit_1->setValidator(new QDoubleValidator(0, 10000.0, 2));

      I am using the double validator for validating the lineEdit_1 field.
      But In the GUI it is taking character "e".
      But not all the alphabets, it takes only character "e".
      May be it is considering as exponential "e" I am not understanding.

      Please let me know how to get rid off this.

      Suggestions are appreciated.

      Thank you.

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by JonB
      #2

      @Shruthi
      Yes, the e character is for "scientific notation" (with an exponent, representing 10 ^ number_after_e).
      See https://doc.qt.io/qt-5/qdoublevalidator.html#notation-prop, you want to try setNotation(QDoubleValidator::StandardNotation) on your validator.

      1 Reply Last reply
      4
      • S Offline
        S Offline
        Shruthi
        wrote on last edited by
        #3

        Thank you so much for your response. @JonB

        1 Reply Last reply
        1
        • S Offline
          S Offline
          Shruthi
          wrote on last edited by
          #4

          Thank you so much it got fixed.
          @JonB

          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