Results 1 to 5 of 5

Thread: [QT3] QToolTip with Images (QPixMap) ?

  1. #1
    Join Date
    Jan 2006
    Location
    Netherlands
    Posts
    56
    Thanks
    10
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default [QT3] QToolTip with Images (QPixMap) ?

    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:

    Qt Code:
    1. tip(rect, QString("<img src=\"image.png\">");
    To copy to clipboard, switch view to plain text mode 

    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:

    Qt Code:
    1. QPixmap::fromMimeSource("image.png")
    To copy to clipboard, switch view to plain text mode 

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

    Maybe anyone can help me..
    Last edited by BrainB0ne; 27th January 2006 at 15:16.
    ..:: Still Standing Strong ::..

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: [QT3] QToolTip with Images (QPixMap) ?

    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).

  3. #3
    Join Date
    Jan 2006
    Location
    Netherlands
    Posts
    56
    Thanks
    10
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: [QT3] QToolTip with Images (QPixMap) ?

    Quote Originally Posted by wysota
    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??

    Qt Code:
    1. tip(rect, QString("<img src=\"image.png\">");
    To copy to clipboard, switch view to plain text mode 

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

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: [QT3] QToolTip with Images (QPixMap) ?

    Yes, it should be ok, provided you have "image.png" in your collection.

  5. #5
    Join Date
    Jan 2006
    Location
    Netherlands
    Posts
    56
    Thanks
    10
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: [QT3] QToolTip with Images (QPixMap) ?

    Quote Originally Posted by wysota
    Yes, it should be ok, provided you have "image.png" in your collection.
    Damn, this is great

    Didn't know it was that simple!
    ..:: Still Standing Strong ::..

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.