[PyKDE] QTextBrowser : strange loadResource behaviour
pinaraf at robertlan.eu.org
Sat Oct 21 10:28:16 BST 2006
I'm facing a strange bug with QTextBrowser, making it near of unusable for me
I need to display some HTML with images embedded. To do that, I've to create a
new QTextBrowser-heriting class, and implement loadResource.
I did so, and it works, but only for local pictures.
Here is my smallest test code :
import sys, httplib, os.path
from PyQt4 import QtGui, QtCore
def loadResource (self, type, name):
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
a = myTextBrowser()
a.document().setHtml("""Coucou :<br /><img src="test.jpg"/>""")
This code just work as expected, it only display one "TypeError: invalid
result type from myTextBrowser.loadResource()" on the console.
Now, if I replace src="test.jpg" with src="http://somewhere/test.jpg" or any
other http:// URL, it'll fail, displaying 10 times the message "TypeError:
invalid result type from myTextBrowser.loadResource()"
I tried the same code using C++, and it just worked.
So I fear it's a PyQt issue :/
I tried the PyQt4 snapshot two days ago, and it didn't work neither.
Do you have any idea to solve this ?
I also got a segfault with PyQt4 snapshot when I tried to use
QDesktopServices, but it was perhaps my fault.
P.S : my PyQt4 is coming from kubuntu edgy packages. It's pyqt4 4.0.1, with
More information about the PyQt