Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. How to set up possible min and max float values with QDoubleValidator
QtWS25 Last Chance

How to set up possible min and max float values with QDoubleValidator

Scheduled Pinned Locked Moved Unsolved Qt for Python
4 Posts 2 Posters 452 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.
  • O Offline
    O Offline
    otaolafr
    wrote on 18 Apr 2023, 19:28 last edited by
    #1

    hello,
    i was reading the documentation for QDoubleValidator https://doc.qt.io/qtforpython-5/PySide2/QtGui/QDoubleValidator.html#PySide2.QtGui.PySide2.QtGui.QDoubleValidator
    and If i understand it correctly, I can set a lower and upper boundaries. but this seems to not work or at least it is not giving the attended result, what I am missing?

    inputs_0=[QLineEdit('1.0')]
    inputs_0[0].setValidator(QtGui.QDoubleValidator(0.0, min(minimimPossibleValues), 8))
    

    I am looking for limit the input values to 0.0 and 0.0045529305934905034 (which is min(minimimPossibleValues)) how can succesfully do this?

    S 1 Reply Last reply 18 Apr 2023, 19:36
    0
    • O otaolafr
      18 Apr 2023, 19:28

      hello,
      i was reading the documentation for QDoubleValidator https://doc.qt.io/qtforpython-5/PySide2/QtGui/QDoubleValidator.html#PySide2.QtGui.PySide2.QtGui.QDoubleValidator
      and If i understand it correctly, I can set a lower and upper boundaries. but this seems to not work or at least it is not giving the attended result, what I am missing?

      inputs_0=[QLineEdit('1.0')]
      inputs_0[0].setValidator(QtGui.QDoubleValidator(0.0, min(minimimPossibleValues), 8))
      

      I am looking for limit the input values to 0.0 and 0.0045529305934905034 (which is min(minimimPossibleValues)) how can succesfully do this?

      S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 18 Apr 2023, 19:36 last edited by
      #2

      Hi,

      Why not use a QDoubleSpinBox directly ?

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

      O 1 Reply Last reply 18 Apr 2023, 19:44
      1
      • S SGaist
        18 Apr 2023, 19:36

        Hi,

        Why not use a QDoubleSpinBox directly ?

        O Offline
        O Offline
        otaolafr
        wrote on 18 Apr 2023, 19:44 last edited by otaolafr
        #3

        @SGaist didnt now it, is it possible to hide the arrows by any chance? found it from the QT designer! thanks again

        S 1 Reply Last reply 18 Apr 2023, 19:55
        0
        • O otaolafr
          18 Apr 2023, 19:44

          @SGaist didnt now it, is it possible to hide the arrows by any chance? found it from the QT designer! thanks again

          S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 18 Apr 2023, 19:55 last edited by
          #4

          If memory serves well, you can use the buttonSymbols property for that.

          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

          2/4

          18 Apr 2023, 19:36

          • Login

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