Is there a Qt widget that will allow me to populate it with HTML markup (including <img src="\dir\graphic.jpg">) for display to the user? It will need to be able to retrieve local images and provide hyperlinks. Is this possible?
thanks,
Jeff
Is there a Qt widget that will allow me to populate it with HTML markup (including <img src="\dir\graphic.jpg">) for display to the user? It will need to be able to retrieve local images and provide hyperlinks. Is this possible?
thanks,
Jeff
Just found the QTextBrowser widget. This seems to display HTML and images. Although I can't seem to get the path correct for displaying an image currently. But I am sure I will figure it out.
Jeff
Ok - how do I get a QTextBrowser to load and display a local HTML file? I seem to be having trouble understanding the C++ code required to do that. Assume the HTML file is in the program directory.
Any quick help with the C++ code required to do this would be very helpful.
Thanks,
Jeff
Sorry to be wasting bandwidth here. I uncovered the answer via some extended searching in these forums.
Qt Code:
To copy to clipboard, switch view to plain text mode
One problem however, I have a graphic file in the same directory as "sample.htm" - "icon5.gif". [WindowsXP, Visual Studio 2005]
The setSrouce() call finds sample.htm, however, the textBrowser loads a "missing" graphic instead of the GIF file I referenced.
Qt Code:
<HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft Visual Studio 8.0"> <TITLE></TITLE> </HEAD> <BODY> <h1>Introduction</h1> <p>This is the first paragraph</p> <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul> <p> <img src="icon5.gif" /> </p> </BODY> </HTML>To copy to clipboard, switch view to plain text mode
Why can't the textBrowser find and display the graphic?
Thanks,
Jeff
Maybe your Qt installation doesn't support gif images. Did you turn on GIF support for Qt? If not, then you've got your reason
JeffJones (24th May 2007)
It was a GIF issue. When I replaced the reference with a JPG file, it was displayed correctly.
Now, the question begs - how does one turn on GIF support?
And, if I may go ahead and piggy-back this thread with a further HTML-related question:
Can the QtextBrowser display buttons and text fields and checkboxes?
And, hoping that the answer is yes, can my code retrieve notification of button clicks; text from text fields and the status of said checkboxes?
Thanks very much for your expertise!
Jeff
You need to rebuild Qt with an option to configure to compile in GIF support: -qt-gif.
No it can't. It's not meant to be a full HTML browser engine, just a rich text display using as subset of HTML/CSS as the markup. However, in the future we will have a pure Qt WebKit, which will be a real HTML engine. It will be several months at least though.
Bookmarks