[PyKDE] provide custom widget to python

Jan Drugowitsch jdrugo at gmx.at
Mon Dec 15 13:20:00 GMT 2003


Hi everyone,

I'm new to qt and have recently created my first custom widget (inherited from 
QScrollView) which works without any problems in C++ code. As I mainly use 
Python for the GUI work I'd like to provide this custom widget for use in 
python. As the sip documentation is pretty sparse and I'm not very 'informed' 
about the inner workings of Qt and how Python exactly handles its objects and 
garbage collection I still have problems achieving this.

My .sip file declares the TokenDisplay class by inheriting QScollView. How do 
I get the reference to QScollView in there without including the whole 
qtmod.sip?
That's the beginning of my .sip class declaration:

class TokenDisplay : QScrollView
{
%HeaderCode
#include "tokendisplay.h"
%End

public:
    // enumeration for TokenClicked signal
    enum MouseButton { RightButton, LeftButton };

    TokenDisplay(QWidget* /TransferThis/ = 0, const char* = 0);
[snip]

Without including anything I get
sip: QScrollView has not been defined
If I include qtmod.sip, headers and wrappers for all the qt classes get 
generated and that's not what I want.

Although I've searched through the mailing list I'm not much wiser than 
before. Does anyone have any cues I can start with? Sorry if this question's 
already been asked several times before.

Best,
Jan




More information about the PyQt mailing list