Implementing a QFilePreview Class with PyQt

Jim jim at somewhere.not
Sun Jun 27 04:58:20 EDT 2004


Christopher Stone wrote:

> Does anyone have an example of how to do this? When I try to make a
> class that subclasses from a QFilePreview class and a QWidget class, I
> get the following error:

> TypeError: Cannot sub-class from more than one wrapped class

I haven't tried it, but looking at the Qt source code, it appears that you
only really need to subclass QFilePreview and provide a previewUrl method. 
I'd try that.

The setInfoPreview and setContentPreview methods both take (QWidget*,
QFilePreview*) and the associated comments say to provide the same pointer
for both arguments if your subclass inherits both, which seems to imply you
could just inherit QFilePreview and construct the QWidget somewhere else.

I didn't notice any place else in qfiledialog.cpp where multiple inheritance
is really required for QFilePreview. Then again, it was a pretty quick look
at the C++ code.

PyQt doesn't allow multiple inheritance of Qt classes in creating a new
Python class. 

There are other possible solutions, but the above is what I'd try first.
You might also get more info from the PyKDE mailing list at
PyKDE at mats.imk.fraunhofer.de. You can sign up at:

   http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Jim





More information about the Python-list mailing list