PDA

View Full Version : [QT3] QToolTip with Images (QPixMap) ?



BrainB0ne
26th January 2006, 19:49
Hello,

I would like to know if it is possible to insert an image from the image collection in a QToolTip.

I know that it's possible to display an image in a tooltip by using HTML code in a QString like:



tip(rect, QString("<img src=\"image.png\">");


but i need to insert a .png from the image collection i created with QT designer.
Normally i use the following function to get an image from the image collection:



QPixmap::fromMimeSource("image.png")


My problem is... i don't have a storage path to that image to insert at the src="" field

Maybe anyone can help me.. :)

wysota
26th January 2006, 22:25
If you set the default mime source of the application to be your image collection you can use images stored there in QToolTip by using its name as the source (so <img src="xxx"> where xxx is the name assigned to an image in the collection).

BrainB0ne
26th January 2006, 23:39
If you set the default mime source of the application to be your image collection you can use images stored there in QToolTip by using its name as the source (so <img src="xxx"> where xxx is the name assigned to an image in the collection).

so this will do the job??



tip(rect, QString("<img src=\"image.png\">");


that would be very great, going to test it tomorrow at work.. thx again! :D

wysota
26th January 2006, 23:43
Yes, it should be ok, provided you have "image.png" in your collection.

BrainB0ne
27th January 2006, 09:31
Yes, it should be ok, provided you have "image.png" in your collection.

Damn, this is great :cool:

Didn't know it was that simple! :D