Results 1 to 2 of 2

Thread: Hw to add a image on QlistWidget's seletced item

  1. #1
    Join Date
    Feb 2010
    Posts
    12
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Hw to add a image on QlistWidget's seletced item

    For example, I have a listwidget, when I select a list item, I want a image show just behind the selected item's text. How to implement this?

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Hw to add a image on QlistWidget's seletced item

    Use delegates. If the item is selected, draw the image in background and then call the base class paint function.
    Also you might need to give sizeHint in case you want the selected item to have a bigger height.

    See QStyledItemDelegateand QItemDelegate

Similar Threads

  1. Drag and drop between QListWidget's
    By estanisgeyer in forum Qt Programming
    Replies: 4
    Last Post: 17th February 2011, 04:29
  2. QListWidget's selection issues
    By mirni in forum Qwt
    Replies: 0
    Last Post: 5th November 2009, 20:08
  3. Replies: 14
    Last Post: 9th November 2006, 08:35
  4. Background image on popup menu item
    By MarkoSan in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 27th June 2006, 05:55
  5. image for a custom menu Item.......
    By Naveen in forum Qt Programming
    Replies: 2
    Last Post: 23rd February 2006, 09:28

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.