[PyKDE] Using PyQt in my .sip file leads to several problems
Sergey ANIKIN
san at nnov.matra-dtv.fr
Thu Aug 8 14:53:00 BST 2002
Domain: Linux C++ Qt-2.2.2 PyQt-3.3.2 sip-3.3.2
I'm trying to write a small C++ class with one method retuning the
desktop widget for my application.
I would like my method to be called from Python script to use the widget
returned as a parent for PyQt dialogs.
I do the following:
// desktop.h:
#include <qwidget.h>
class Desktop
{
public:
static QWidget* getDesktop();
};
// desktop.cxx:
#include <qapplication.h>
QWidget* Desktop::getDesktop()
{
return qApp::desktop();
}
// desktop.sip:
%Module Desktop
# FIRST PROBLEM: I had to include almost all PyQt .sip files here in
order to make SIP work without errors. Otherwise, it reports "QWidget is
not defined", etc.
# Is it right?
%Include versions.sip
%Include qglobal.sip
...
%Include qwidget.sip
...
class Desktop
{
%HeaderCode
#include <Desktop.h>
%End
public:
static QWidget* getDesktop();
};
SECOND PROBLEM:
Well, I processed desktop.sip with SIP and it produced more than 400 (!)
.cc and .h files. I guess it practically duplicated those of PyQt except
my Desktop files.
Can I do anything to reduce the number of SIP-generated files to a
reasonable extent?
THIRD PROBLEM:
Three of intermediate .cc/.h files include PyQt intermediate files
(sipqtQObject.h, sipqtQWidget.h and sipqtQFileInfo.h;these files are
included directly by PyQt .sip files). I had to edit the intermediate
files manually in order to include my versions of the files
(sipDesktopQObject.h, etc.). Perhaps this results from the FIRST
PROBLEM. Who knows how to avoid this?
FOURTH PROBLEM:
When I try to compile intermediate .cc/.h files with GCC I get the
following errors:
/users/san/PyQt-3.3.2/sip/qobject.sip: In function `PyObject
*PyQtGetQObjectPythonClass (const QObject *)':
/users/san/PyQt-3.3.2/sip/qobject.sip:684: `sipName_qt_QAccel'
undeclared (first use this function)
/users/san/PyQt-3.3.2/sip/qobject.sip:684: (Each undeclared identifier
is reported only once for each function it appears in.)
/users/san/PyQt-3.3.2/sip/qobject.sip:686: `sipName_qt_QAction'
undeclared (first use this function)
/users/san/PyQt-3.3.2/sip/qobject.sip:687: `sipName_qt_QActionGroup'
undeclared (first use this function)
/users/san/PyQt-3.3.2/sip/qobject.sip:689: `sipName_qt_QApplication'
undeclared (first use this function)
....
and so on for every Qt class referred. Once again, I've got links to
PyQt intermediates. Only after changing them to sipName_Desktop_QAccel,
etc. I was able to compile the stuff though it took me more than an hour
on PIII-750!
QUESTION: Is there anybody who knows how to do it right to fix all the
above-mentioned, i.e. to remove numerous links to PyQt intermediate
files and to make my intermediate code compact?
Best regards!
More information about the PyQt
mailing list