Details
-
Bug
-
Resolution: Unresolved
-
P4: Low
-
None
-
6.4.1
-
None
Description
Setting the maximum of a QDoubleSpinBox to NaN sets its value to NaN. This is not documented, but it is not documented that it does not do that, so I can kind of accept it.
However, when doing so repeatedly, QDoubleSpinBox.valueChanged fires repeatedly although the value has not changed.
I created a Python-based example at https://bugreports.qt.io/browse/PYSIDE-2126. Unfortunately, I do not have a Qt-C++ dev environment installed, so I have not way of translating it. but I guess it is easy enough to read in Python code, the gist being:
QApplication() box = QDoubleSpinBox() box.valueChanged.connect(lambda: print("This should print only once.")) box.setMaximum(math.nan) # this calls value_changed, as expected (I guess) box.setMaximum(math.nan) # this calls value_changed, certainly unexpected!
I would expect the second call to setMaximum to not fire anything, as the maximum hasn't changed and the value hasn't changed.