[PyKDE] PyQt4 and SIP-4.4.5 issues
Gerard Vermeulen
gerard.vermeulen at grenoble.cnrs.fr
Sat Sep 16 11:52:34 BST 2006
Phil,
The attached PyQt4.pyqwt.patch (a bit hardwired, but IMO not worth a more general
solution) makes it possible to use the Qwt5 designer plugin with pyuic4 without
editing the generated Python code (it is impossible to infer the PyQwt module
from the header filenames returned by the plugin).
In porting PyQwt3D to PyQt-4, I found problems with the SIP DECLARATIONS
below (the code runs when built against Qt3 but not against Qt4,
because qRegisterMetaType does not work with abstract classes).
The private copy constructors are only partial solutions, because the the
classes can still be instantianated from Python.
The documentation for the /Abstract/ annotation feels a bit out of date:
some time ago /Abstract/ really indicated an abstract class, but nowadays
it means a class that cannot be instantianated *and* cannot be subclassed.
DECLARATION 1:
// GridMapping is a normal base class
class Function: GridMapping
{
%TypeHeaderCode
#include <qwt3d_function.h>
%End // %TypeHeaderCode
public:
Function();
virtual ~Function();
// SIP-4.4.5 parses the pure virtual operator,
// but does not treat Function as an abstract class
virtual double operator()(double, double) = 0;
...
private:
// ?? SIP-bug: a regression with respect to SIP-4.3.x ??
// This class is not recognized as abstract
// The code for Qt-4 does not compile unless a private copy constructor
Function(const Function&);
}; // class Function
DECLARATION 2:
class Drawable
{
%TypeHeaderCode
#include <qwt3d_drawable.h>
%End // %TypeHeaderCode
public:
// In C++ the destructor is declared as pure virtual.
// There are no other virtual functions,
// but SIP does not parse the pure specifier "= 0"
virtual ~Drawable() /* = 0 */;
...
private:
// I do not know how to get this class recognized as abstract
// The code for Qt-4 does not compile unless a private copy constructor
Drawable(const Drawable&);
}; // class Drawable
Gerard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PyQt4.pyqwt.patch
Type: application/octet-stream
Size: 1280 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20060916/1fdfa62d/PyQt4.pyqwt.obj
More information about the PyQt
mailing list