[PyKDE] sip generated code does not compile

gvermeul at labs.polycnrs-gre.fr gvermeul at labs.polycnrs-gre.fr
Sat Aug 18 11:18:09 BST 2001


Phil,

while adapting my PyQwt extension to sip/PyQt-2.5, sip generated some code that
does not compile (no problems with sip-2.5pre1, sip-2.4 and earlier).

There is some sort of "horizon" effect with inclusion of the declarations of 
'sipQClasses' in combination with protected member functions.

To be more precise (code fragments in the PPS):

QwtArrowButton is derived from QPushButton, which is derived from QButton.
QButton has protected member functions, so for instance this line of code is
generated by sip in the C++ code wrapping QwtArrowButton:

sipQButton::sipVH_drawButton(&sipPyMethods[89],sipPyThis,relLock,a0);

But, the declaration for sipQButton is not included in the corresponding header
file. Of course, it is easy to work around this sip bug (see below).

Gerard

PS: quite a few things changed going from sip/PyQt-2.5pre1 to 2.5. The fact
that PyQt-2.5pre4 would only build for brand new versions of Qt prevented me
from testing (too lazy for CVS).
Maybe, you should release PyQt in a version intermediate between the CVS and
your actual releases: generate the documentation (not everyone has a working
db2html) and let sip generate the code needed for the version of Qt present on
the system. At least, that is how I am going to release the next version of
PyQwt.

PPS: the code fragments:

-- start excerpt from qwt_arrbtn.sip --
%HeaderCode
#include <qwt_arrbtn.h>
%End

class QwtArrowButton: QPushButton
{
public:
    enum Direction {
        Up,
        Down,
        Left,
        Right
    };

    QwtArrowButton(int, Direction, QWidget * /TransferThis/, const char * = 0);
    Direction dir() const;
    int num() const;
    QSize sizeHint() const;

protected:
    void drawButtonLabel (QPainter *);
};
-- end excerpt --

This leads to the following code fragment from 'sipqwtArrowButton.cpp', that
fails to compile, unless I add a line:

#include "sipqtQButton.h" // overlooked by sip!

to the sip generated header file 'sipqwtArrowButton.h'

-- start fragment from sipqwtArrowButton.cpp --
void sipQwtArrowButton::drawButtonLabel(QPainter * a0)
{
	int relLock;

	if (sipIsPyMethod(&sipPyMethods[88],sipPyThis,NULL,sipName_qt_drawButtonLabel,&relLock))
		sipQButton::sipVH_drawButtonLabel(&sipPyMethods[88],sipPyThis,relLock,a0);
	else
		QwtArrowButton::drawButtonLabel(a0);
}

void sipQwtArrowButton::drawButton(QPainter * a0)
{
	int relLock;

	if (sipIsPyMethod(&sipPyMethods[89],sipPyThis,NULL,sipName_qt_drawButton,&relLock))
		sipQButton::sipVH_drawButton(&sipPyMethods[89],sipPyThis,relLock,a0);
	else
		QPushButton::drawButton(a0);
}

-- end fragment --


---------------------------------------------
This message was sent using Endymion MailMan.
http://www.endymion.com/products/mailman/






More information about the PyQt mailing list