Am trying to insert the HTML file in the TextEdit !! After inserting, only the Texts and Links are being loaded in the TextEdit widget. Why the images are not loaded ???
Am trying to insert the HTML file in the TextEdit !! After inserting, only the Texts and Links are being loaded in the TextEdit widget. Why the images are not loaded ???
Maybe the path (href) is not valid. Or try to embed them. See the wiki article I have wrote long time ago: [WIKI]QTextBrowser with images and CSS[/WIKI] (It might be not any more state of the art, but should still work.)
rleojoseph (1st March 2011)
Thanks sir, But am trying to insert a saved html file in the TextEdit !
How are the href defined? You can alter the HTML files and add a "base href" or still load the images to the resource file.
am using the following code
Qt Code:
//in.setCodec("UTF-8"); inputFile.close(); cursor.insertHtml(line);To copy to clipboard, switch view to plain text mode
...and? It probably would be helpful if you post an example of the actual HTML you are about to insert.
Assume that i have save a webpage from this link http://doc.qt.nokia.com/4.7/classes.html. I have saved this webpage in my system and trying to insert it .
Look, a QTextEdit is not intended to display whole webpages. Use webkit for it. If you still want to use the text edit, you have to embed all images into the resource or adjust the file paths. You then also have to go through the css files! But that is really pain in the a***
rleojoseph (1st March 2011)
Lykurg about your wiki article, I use a similar system for displaying images in a QTextBrowser, we have a system where I make a request to the database/server (depending whether we are offline or online) to get the html and then I intercept the QTextBrowser::loadResource calls to load any images/audiofiles from the appropriate datasource, then I call qtextdocument.add resource like in your article.
My question is can i trust the QTextBrowser's resource cache to limit itself to a respectable size or should I worry about unloading the resources manually? ( I don't know much about how it's resource cache works )
Bookmarks