[PyKDE] QFilePreview - cryptic RuntimeError
Phil Thompson
phil at riverbankcomputing.co.uk
Tue Feb 10 22:58:01 GMT 2004
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