[PyKDE] Platform specific sip/PyQt problem.

Smith, Dave dave.smith at transcendata.com
Tue May 7 02:04:00 BST 2002


I've narrowed down a platform specific problem with sip/PyQt
about as far as I have time to right now, the problem occurs on
Solaris with the SUNWspro 4.2 compilers (and the SUNWspro
5.3 compilers with the -compat option) as well as older versions
of IRIX and AIX.

All of the example programs worked but when I tried to run "kalam" from the
PyQt book, I got a RuntimeError trying to connect to a QAction toggled(bool)
signal.  Here's some simple code that reproduces the problem:

rocket - dts> spyqt
Platform: plat-sunos5
Qt Version: 3.0.4
SIP Version: 3.2.1
PyQt Version: 3.2
rocket - dts> python
Python 2.0 (#15, Jul 20 2001, 10:21:38) [C] on sunos5
Type "copyright", "credits" or "license" for more information.
>>> from qt import *
>>> def f (s):
...    print s
... 
>>> qApp = QApplication ([])
>>> qMainW = QMainWindow (None, "MainWindow")
>>> button = QPushButton (qMainW, "Button")
>>> button.setText ("Button")
>>> qMainW.setCentralWidget (button)
>>> qApp.setMainWidget (qMainW)
>>> button.setToggleButton (1)
>>> button.connect (button, SIGNAL("toggled(bool)"), f)
QObject::connect: No such slot sipProxyqt::proxySlot(bool)
QObject::connect:  (sender name:   'Button')
QObject::connect:  (receiver name: 'unnamed')
0
>>> qMainW.show()
>>> qApp.exec_loop()
0
>>>

The above code works with my Windows 2000 and HP-UX 10.20 builds.

What is different with my solaris builds, you ask?  Since I started dealing
with PyQt around version 2.4 w/ Qt 2.3.0 solaris has always given the following
compiler error:

 o Compiler Error: CC -DHAVE_CONFIG_H -I. -I. -I..
   -I/users/toollib/include/python2.0 -I/users/pyqt/install/sip-3.2.1/include
   -I/users/pyqt/install/qt-x11-commercial-3.0.4/include -I/usr/openwin/include
   -c qtcmodule.cpp  -KPIC -DPIC -o qtcmodule.o
   "sipqtProxyqt.h", line 113: Error: Multiple declaration for
   sipProxyqt::proxySlot(int).
   "qtcmodule.cpp", line 5393: Error: sipProxyqt::proxySlot(int) already had a
   body defined.

to which I have always applied this "workaround":

   This occurs because of the way the SUNPro CC 4.2 compiler interprets the
   'typedef int bool;' statement in qt-2.3.0/include/qglobal.h.  The compiler
   can not distinguish between 'bool' and 'int' types in the signature of the
   overloaded function 'proxySlot'.  To workaround this I '#if 0'ed out the
   declaration and body of 'proxySlot(bool)' in qt/sipqtProxyqt.h and
   qt/qtcmodule.cpp, 'proxySlot(int)' will be called for both cases.

Guess I had never tried to connect to a signal with a boolean argument before today
or I would have seen this problem a lot sooner...

Any ideas on a better way to resolve this compiler error?  If not, can sip be
changed to make it treat a bool as an int in this case?

I'd be more than happy to test/verify any patches that might fix this problem
in case getting access to a Solaris box w/ proper compilers is a problem.

Thanks!

Dave




More information about the PyQt mailing list