[PyKDE] about QPEApplication and QMainWindow
douard at magic.fr
Tue Aug 13 13:48:57 BST 2002
I am developping a little app (for the zaurus contest) using PyQt. And I have
found several problems...
First, I am still obliged to comment out a few lines in the sip files in order
to compile PyQt... (gcc complains about accessing vars which are declared
private in the master C++ class and thus not availbale in any derived
class---which is normal. So I still do not understand how PyQt can be
compiled out of the box. NB: I am using Qtopia as available to Trolltech's
site, GPL version).
Then I have spent almost a day to realize that I had many problems with the
Qtopia integration of my app which where du to the fact that the
/tmp/qcop-msg file was not opened, read end destroyed by my app... Which was
due to the fact that, in the QApplication code (file qapplication.cpp), the
name of the program (argv) is filtered (to remove full path and so) AFTER
the file /tmp/qcop-msg/appname if opened... And Python gives the fullpath as
So I could solve this easily just by filtering the args given to my
It's trivial but one can spen time on it (as I did). Maybe a little TIP file
(or FAQ entry) on the PyQt site would be nice ?
Last, I use a QMainWindow derived class as main widget. But the problem is
that the QMainApplication does NOT declare slots which are used by
QApplication to send messages like "newDocument" or "accept". In the C++
world, you just have to subclass QMainApplication declaring thoses
fuctions... But if I subclass it with a python class, messages are not
transmited... I haven't looked deeply, but I guess it is not possible for a
C++ class to send a message (at the c++ level. When I say send, I mean
calling the slot function as done in QPEApplication code for "setDocument",
for example) to a purely python defined slot... (Am I wrong ?)
In this case you (I mean Phil) should provide a QPEMainApplication class with
an associated python binding which just declare thoses required slot
functions as virtual, so user can redefine them at Python level.
It is what I have done for my little app, but it would be nice to have that
explained and implemented in PyQt...
Thanks for any answer...
PS: I am not on the ML, so please CC me back. Thank you.
More information about the PyQt