Results 1 to 4 of 4

Thread: Best way to add icon / small picture

  1. #1
    Join Date
    May 2009
    Posts
    30
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Red face Best way to add icon / small picture

    Hello guys,

    I'm looking to add a small icon or picture beside a label, and within a QTableWidget. I was wondering what's the best way to go about this? Which class to use? I'm going to have to update the icon / picture in run-time, from one icon / picture to another.

    Thanks much.

    Regards,
    Pembar

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Best way to add icon / small picture

    take a look at QTableWidgetItem::setIcon.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    May 2009
    Posts
    30
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Best way to add icon / small picture

    Is there a way to add a picture / icon to a QLabel? It has to be beside the text.

    If not, what's the best way to add it beside a QLabel within a HBoxLayout?

    Regards,
    Pembar

  4. #4
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    229
    Thanks
    2
    Thanked 29 Times in 28 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Best way to add icon / small picture

    To have a icon AND text side-by-side you should use to different labels, one holding the icon to other for the text. Both labels in a QHBoxLayout as already stated.
    Last edited by Boron; 18th May 2009 at 18:59.

  5. The following user says thank you to Boron for this useful post:

    Pembar (19th May 2009)

Similar Threads

  1. QMessageBox missing icon
    By zanth in forum Qt Programming
    Replies: 3
    Last Post: 8th July 2010, 21:20
  2. How to get pushbutton as an icon
    By Pembar in forum Newbie
    Replies: 1
    Last Post: 12th May 2009, 19:59
  3. Couple of questions: main window icon + toolbar icon
    By bpackard in forum Qt Programming
    Replies: 0
    Last Post: 20th March 2008, 19:03
  4. Mac application and the Dock Icon
    By sekelsenmat in forum Qt Programming
    Replies: 3
    Last Post: 26th September 2007, 10:23
  5. tool bar icon size looking small???
    By darpan in forum Qt Tools
    Replies: 7
    Last Post: 31st March 2006, 16:38

Tags for this Thread

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.