Results 1 to 3 of 3

Thread: Problem: QLabel/HTML/Open external Link/Display resource icon

  1. #1
    Join Date
    Nov 2007
    Posts
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Question Problem: QLabel/HTML/Open external Link/Display resource icon

    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.

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem: QLabel/HTML/Open external Link/Display resource icon

    How about <img src=":/YOURIMAGE.png">? And can't you use a flat push button instead?

  3. #3
    Join Date
    Nov 2007
    Posts
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem: QLabel/HTML/Open external Link/Display resource icon

    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 )

    Bye,
    uglykid

Similar Threads

  1. Client/Server Error: BadIDChoice
    By 3nc31 in forum Qt Programming
    Replies: 5
    Last Post: 27th November 2007, 10:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.