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. QIntValidator for fixed value
QtWS25 Last Chance

QIntValidator for fixed value

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 340 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.
  • A Offline
    A Offline
    Ayush Gupta
    wrote on last edited by
    #1

    I have below two conditions

    • Validate the value in column of tree based on minumum and maximum range.
    • Valdiate the value in column of tree based on some fixed.

    So suppose minrange is 0 and maxrange is 24
    and fixed value is 45.

    so use can able to enter value between 0-24 and fixed value 45.

    I am able to control for minimum and maximum range using QIntValidator.

    But is there any way I can handle the same thing for fixed value using QIntValidator or any other way?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      Kerndog73
      wrote on last edited by
      #2

      Just to make sure I understand, a value is deemed valid if it is between 0 and 24 (inclusive) or equal to 45. Is that correct?

      If so, QIntValidator doesn’t support this. You’ll have to make your own validator. Writing a custom validator is trivial if you read the docs.

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

        Hi,

        Out of curiosity, why is that fixed value outside of the range ? Also why so far from the range ?

        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
        2
        • A Offline
          A Offline
          Ayush Gupta
          wrote on last edited by
          #4

          @SGaist It is my requirement

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Ayush Gupta
            wrote on last edited by
            #5

            @Kerndog73 oh means entirely writing a seperate class for this purpose

            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