PDA

View Full Version : Can QTextBrowser display remote images?



golnaz
21st January 2009, 12:37
I use a QTextBrowser in my code, and pass an html text to it via QTextBrowser::setHtml() function.
but it can't display images on the web, for example, when I pass this text to the above function:


<p><img src="http://i39.tinypic.com/2cqlhtg.jpg" /></p>


just an file icon will be showed in the QTextBrowser, not the image itself.
but it can display images on local computer, even when the image path starts with "file://" prefix.

after all, is there any flag which I should set to make QTextBrowser get the image data automatically? or is there any similar qt widget which I can use instead?
I know QWebView can display both local and remote images, but I need a widget with ability to edit its content.

thanks.

jpn
21st January 2009, 13:45
Unfortunately QTextBrowser can show local images only. However, there's a way to load remote files yourself via QTextBrowser::loadResource(). See QTextEdit and delayed image loading (http://www.qtcentre.org/forum/f-qt-programming-2/t-qtextedit-and-delayed-image-loading-6744.html) for more details.