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
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved Qt for Python
4 Posts 2 Posters 485 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.
  • O Offline
    O Offline
    otaolafr
    wrote on 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?

    SGaistS 1 Reply Last reply
    0
    • O otaolafr

      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?

      SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on 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
      1
      • SGaistS SGaist

        Hi,

        Why not use a QDoubleSpinBox directly ?

        O Offline
        O Offline
        otaolafr
        wrote on 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

        SGaistS 1 Reply Last reply
        0
        • O otaolafr

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

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on 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

          • Login

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