Results 1 to 3 of 3

Thread: QListWidget access item after using listWidget->setItemWidget

  1. #1
    Join Date
    Feb 2011
    Location
    Latvia
    Posts
    139
    Thanks
    24
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QListWidget access item after using listWidget->setItemWidget

    So i created custom widget containing a picture, and 3 labels. I created a list, where there custom widgets are used as items. I would like to know if it is possible to access the data from these items (I used "listWidget->setItemWidget" to make list items). For example first label contains some URL, i want to use it later, how do i access it?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QListWidget access item after using listWidget->setItemWidget

    See QListWidget::itemWidget() and cast it to the widget type you want.

  3. #3
    Join Date
    Feb 2011
    Location
    Latvia
    Posts
    139
    Thanks
    24
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QListWidget access item after using listWidget->setItemWidget

    I don't know what happened but my message got lost.
    I am new to qt, and i learned just basics of C++. What is cast, and how to use it?


    Added after 20 minutes:


    And another question that i have right now:
    I have custom items in mi ListWidget. They can be different size. How to make those list items resize to their content?
    Last edited by Archa4; 3rd February 2011 at 10:07.

Similar Threads

  1. Replies: 0
    Last Post: 29th November 2010, 05:34
  2. Replies: 7
    Last Post: 19th October 2010, 08:32
  3. ListWidget item's height
    By BalaQT in forum Qt Programming
    Replies: 1
    Last Post: 12th July 2010, 13:51
  4. Replies: 0
    Last Post: 16th June 2010, 13:09
  5. ListWidget positions item
    By talex in forum Qt Programming
    Replies: 3
    Last Post: 21st October 2008, 15:16

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.