Results 1 to 2 of 2

Thread: Need Help Subclassing QListWidget / QListWidgetItem

  1. #1
    Join Date
    Jul 2010
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Need Help Subclassing QListWidget / QListWidgetItem

    Alright, so basically I am trying to store a bunch of additional data with the QListWidgetItems which im adding the the QListWidget. So I have subclassed QListWidgetItem to add the extra data along with their accessors and mutators. I can store them the QListWidget and such, but I also need the signals and slots to return my subclassed items not QListWidgetItems..

    I cant seem to figure out how to subclass the QListWidget to return my subclassed QListWidgetItem

    I am trying to use the currentItemChanged(QListWidgetItem*, QListWidgetItem*); signal

    Can anyone help? Thanks!

  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: Need Help Subclassing QListWidget / QListWidgetItem

    Well, if you have subclasses QListWidgetItem, then currentItemChanged(QListWidgetItem*, QListWidgetItem*) should work.
    In slot you can type cast the QListWidgetItem to your class.

    Also if your data is not too big, you can always use QListWidgetItem::setData with a custom role.

Similar Threads

  1. QListWidget and QListWidgetItem
    By Noxxik in forum Qt Programming
    Replies: 5
    Last Post: 3rd August 2011, 09:59
  2. Replies: 1
    Last Post: 11th May 2010, 02:52
  3. delete QListWidgetItem in QListWidget
    By sophister in forum Qt Programming
    Replies: 1
    Last Post: 10th May 2009, 15:52
  4. Problems subclassing QListWidgetItem
    By Morea in forum Qt Programming
    Replies: 2
    Last Post: 8th May 2006, 09:27
  5. QListWidget add QListWidgetItem
    By fellobo in forum Qt Programming
    Replies: 3
    Last Post: 20th February 2006, 19:37

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.