[PyKDE] QFilePreview - cryptic RuntimeError

Martin Takeo Wiechert martin.wiechert at gmx.de
Wed Feb 11 11:42:00 GMT 2004


Oops!

Thanks, Martin.

Am Tuesday 10 Feb 2004 22:55 schrieben Sie:
> On Wednesday 11 February 2004 8:21 pm, Martin Takeo Wiechert wrote:
> > Hi.
> >
> > I get the following error
> >
> > Traceback (most recent call last):
> >   File "preview.py", line 19, in ?
> >     fd.setContentsPreview (w, p)
> > RuntimeError: underlying C/C++ object has been deleted
> >
> > when calling the script below.
> > I'm completely lost with that. Any suggestions?
> >
> > Thanks, Martin.
> >
> >
> > from qt import *
> >
> > class preview (QFilePreview):
> >     def __init__ (self, widget):
> >         self.widget = widget
> >     def previewUrl (self, url):
> >         print url
> >         self.widget.setText ('Hi')
> >
> > app = QApplication ([])
> > fd = QFileDialog ()
> > w = QLabel (None)
> > p = preview (w)
> > fd.setContentsPreviewEnabled (True)
> > fd.setContentsPreview (w, p)
> > fd.setPreviewMode (QFileDialog.Contents)
> > fd.show ()
> > QObject.connect (app, SIGNAL ('lastWindowClosed ()'), app, SLOT ('quit
> > ()')) app.exec_loop ()
>
> You need to call QFilePreview.__init__() from preview.__init__().
>
> Phil




More information about the PyQt mailing list