By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,770 Members | 1,799 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,770 IT Pros & Developers. It's quick & easy.

Implementing a QFilePreview Class with PyQt

P: n/a
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
Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Jim
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
Py***@mats.imk.fraunhofer.de. You can sign up at:

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

Jim
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.