[PyKDE] How to inherit from QWidget

Jim Bublitz jbublitz at nwinternet.com
Mon Jan 20 22:10:01 GMT 2003


On 20-Jan-03 Paul F. Kunz wrote:
> I have a class, QtViewWidget which in C++ in herits from
> QWidget and class in my C++ library.   How do I tell SIP to use
> QWidget from PyQt instead of creating a local QWidget in my
> build directory?

Are you using sip to write bindings for your C++ lib? In that case
you need to:

1. %Import qtmod.sip before your list of %Includes for your own
files

2. When you run sip to generate code for the bindings, add a -I
switch with the path to qtmod.sip, for example:

    sip ... -I /usr/local/PyQt/sip ...

3. For gcc, add a -l qtcmodule wherever you specify the libs to be
linked with your module (and -L ...python/site-packages or wherever
libqtcmodule.so is located if you don't already have that), and a
-I for the path to the Qt h files (not the same path as in (2))

That will also add a bunch of sipqt*.h files to the directory where
your sip-generated C++ code is located.


Jim




More information about the PyQt mailing list