[PyKDE] Platform specific sip/PyQt problem -- SUMMARY

Smith, Dave dave.smith at transcendata.com
Fri May 24 15:36:32 BST 2002


All,

Thanks to a few pointers from Phil, I have a workaround
for the problem described below (can't connect to 'toggled(bool)'
signals on specific platforms).  AFAIK, this affects users of Solaris
Sun Workshop C++ 4.2 & Sun Forte C++ 6.x using the -compat option,
IRIX MIPSpro 7.2.1 and older, and all versions of AIX IBM C++
(VisualAge C++ should be ok).  I don't think there is a
automated solution to this as the root problem is a compiler bug
that has been accepted as a "feature" of older C++ compilers.
I only had time and need to test this workaround on Solaris, but
I think it will fix IRIX and AIX as well.

Attached is a detailed description of the problem and
workaround that can be added to the PyQt README.SunOS file.

Dave

-----Original Message-----
From: Smith, Dave 
Sent: Monday, May 06, 2002 8:03 PM
To: PyQt/KDE Mailing List (E-mail)
Subject: [PyKDE] Platform specific sip/PyQt problem.


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

_______________________________________________
PyKDE mailing list    PyKDE at mats.gmd.de
http://mats.gmd.de/mailman/listinfo/pykde
-------------- next part --------------
A non-text attachment was scrubbed...
Name: README.SunOS.PyQt
Type: application/octet-stream
Size: 1962 bytes
Desc: README.SunOS.PyQt
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20020524/2c7f1b84/README.SunOS.obj


More information about the PyQt mailing list