[PyKDE] QTextBrowser & QMimeSourceFactory
phil at river-bank.demon.co.uk
Mon Apr 3 22:03:20 BST 2000
Pete Ware wrote:
> I'm trying to use QTextBrowser but I'm not able to ever change what is
> currently being displayed. My guess is that PyQt is messing up
> reference counting. The following script demonstrates the problem.
> If you run this, you'll get a blank window. If you comment out one of
> the suggested lines, things work.
> Any ideas?
I've added a couple of print statements...
#! /usr/bin/env python
app = qt.QApplication (sys.argv)
main = qt.QMainWindow ()
text = qt.QTextBrowser (main)
mime_default = qt.QMimeSourceFactory ()
#mime_path = qt.QStringList
mime_default.setText ('help-start.html', '<b>this is a test</b>')
mime_default.setText ('test.html', '<b>test 2</b>')
# Comment out just one of these and it works
The call to mimeSourceFactory().data() is what is failing inside the
second setSource(), and this failing is caused by the first setSource().
Looking at the comments in the Qt documentation for
QMimeSourceFactory::data() I'd guess that this is just the way it works
and not a PyQt problem.
More information about the PyQt