PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 722 - float vs. qreal conflict in new-style-signals
: float vs. qreal conflict in new-style-signals
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: QtGui
: 1.0.0
: All All
: P3 normal
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2011-03-11 16:44 EET by Hugo Parente Lima
Modified: 2011-05-26 17:04 EEST (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hugo Parente Lima 2011-03-11 16:44:02 EET
This doesn't work:

#!/usr/bin/env python
import sys
from PySide import QtCore, QtGui
app = QtGui.QApplication(sys.argv)
foo1 = QtGui.QDoubleSpinBox()
foo2 = QtGui.QDoubleSpinBox()
foo1.valueChanged[int].connect(foo2.setValue)
foo2.valueChanged[int].connect(foo1.setValue)
foo1.show()
foo2.show()
sys.exit(app.exec_())

PySide doesn't find the Qt signal throwing an error.

IndexError: Signature valueChanged(int) not found for signal: valueChanged
Comment 1 Lauro Moura 2011-03-11 18:59:42 EET
Err, the code snippet is using QDoubleSpinBox...
Comment 2 Hugo Parente Lima 2011-03-11 19:04:21 EET
(In reply to comment #1)
> Err, the code snippet is using QDoubleSpinBox...

Fixed version bellow:

#!/usr/bin/env python
import sys
from PySide import QtCore, QtGui
app = QtGui.QApplication(sys.argv)
foo1 = QtGui.QDoubleSpinBox()
foo2 = QtGui.QDoubleSpinBox()
foo1.valueChanged[float].connect(foo2.setValue)
foo2.valueChanged[float].connect(foo1.setValue)
foo1.show()
foo2.show()
sys.exit(app.exec_())
Comment 3 Lauro Moura 2011-03-11 19:57:03 EET
QSpinBox valueChanged works nicely for both QString and int overloads, but
QDoubleSpinBox does not work for the unique float version.

Changing the summary.

Added some unit tests covering it:

http://qt.gitorious.org/~lauromoura/pyside/lauro-pyside/commit/032d4eca017ad078e6f8f38062e3c9c70b32de29
Comment 4 Lauro Moura 2011-03-11 19:57:45 EET
s/double/float/ for the sake of clarity :)
Comment 5 Lauro Moura 2011-03-12 19:23:25 EET
The same happens to QInputDialog.doubleValueChanged[float], with the following
error output:

Traceback (most recent call last):
  File "dialog.py", line 12, in <module>
    dialog.doubleValueChanged[float].connect(callback)
IndexError: Signature doubleValueChanged(qreal) not found for signal:
doubleValueChanged

It seens that the float argument to [] is translated to qreal instead of double
when generating the signal signature string.
Comment 6 Lauro Moura 2011-03-14 13:55:13 EET
Rephrased the summary to better reflect the real problem. PySide indeeds
translated "float" to "qreal" when generating data to check the signature.
Comment 7 renato filho 2011-04-14 00:32:46 EEST
fixed on pyside commit:

commit 3e69981b4bb752615173e2a5a9657d00b957ab0f
Author: Renato Filho <renato.filho@openbossa.org>
Date:   Wed Apr 13 15:09:20 2011 -0300
Comment 8 renato filho 2011-04-29 18:06:24 EEST
PySide release 1.0.2
Comment 9 Didier Raboud 2011-05-10 13:17:03 EEST
Hi, 

this is unfortunately not fixed (at least on the Debian armel port), with the
following error: 

181/317 Test #181: QtGui_bug_722 ...................................***Failed  
 4.85 sec
.F
======================================================================
FAIL: testQRealSignal (__main__.TestSignalConnection)
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/build/buildd-pyside_1.0.2-1-armel-iOPKdd/pyside-1.0.2/tests/QtGui/bug_722.py",
line 21, in testQRealSignal
    self.assertEqual(foo1.value(), effect.blurRadius())
AssertionError: 0.42 != 0.41999998688697815

----------------------------------------------------------------------
Ran 2 tests in 0.115s

FAILED (failures=1)
[151446 refs]
-------------------------------
WrapperMap: 0x5fd3e8 (size: 0)
-------------------------------

The full build log is available there:
https://buildd.debian.org/status/fetch.php?pkg=pyside&arch=armel&ver=1.0.2-1&stamp=1304636284

Cheers, 

OdyX
Comment 10 Hugo Parente Lima 2011-05-10 20:09:42 EEST
The problem was in the unit test, not in the fix, I replaced the assertEqual by
an assertAlmostEqual and the test now should pass.

fixed unit test in commit:

pyside/18e0ece1c964079b4b71e46bb1d1862950ea7935
Comment 11 renato filho 2011-05-26 17:04:10 EEST
PySide release 1.0.3