PDA

View Full Version : Problem: QLabel/HTML/Open external Link/Display resource icon



uglykid
13th January 2008, 14:09
Hi,

I want to do the following (with Qt4.3.2/Windows/VS2005 Pro):
Display an Icon in a widget that responds to a click by opening an external browser with a specific web page.

What i do:

- Create a QLabel widget insert it into my parent widget.
- I activate mouse click sensitivity.
- I set the QLabel-Text to something similar like:
<a href="http://xyz.com"><img src=url(:/MYIMAGE.png)></a>

Well, the problem arises with the IMG tag. What i want to do is address an image located in my qt resources. BUT instead of displaying MYIMAGE.png Qt does display a kind of dummy image (a document icon) that (at least) reacts as expected. :eek:

What am i doing wrong with the syntax here?
How do i correctly address the image that is stored in my Qt resources from the qlabel text string?

Of course i could also do all this above stuff by hand implementing my own qt classes...but it would of course be much better to get this run with QLabel!

Thanks for your all help in advance,
frank

jacek
13th January 2008, 21:28
How about <img src=":/YOURIMAGE.png">? And can't you use a flat push button instead?

uglykid
14th January 2008, 18:09
Hi,
thanks for the hint. ;)
I have talked back with trolltech support and it turned out that my approach was absolutely correct except for the Visual Studio 2005 Qt-VS integration module did not display my settings correctly.

I did not want to use a flat button because of the fact that qlabel is a little more comfortable when it comes to opening an external HTML-Viewer. (A flat button requires some signal conencting to achieve the same effect...at least as far as i know...i am a little lazy :cool:)

Bye,
uglykid