PDA

View Full Version : Need Help Subclassing QListWidget / QListWidgetItem



bl1nk
22nd July 2010, 01:23
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!

aamer4yu
22nd July 2010, 04:58
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.