PDA

View Full Version : How to show list of labels taken from QMap?



Olivia
22nd April 2011, 18:28
Hi

I've created QMap of <String, MyClassItem> and I need to list all items in that map, by showing MyClassItemObject.name. I also would like to edit/remove an MyClassItemObject by selecting it on the list and pushing a button (causing new dialog to appear).
My first thought was to subclass QListWidgetItem, adding a pointer to object that has the same name as QListWidgetItem.text. Is that a good or bad idea?

Olivia
23rd April 2011, 18:55
BUMP.

I created an image to show exactly what I need.
http://img703.imageshack.us/img703/7137/screenshot20110423at741.th.png (http://img703.imageshack.us/i/screenshot20110423at741.png/)

Uploaded with ImageShack.us (http://imageshack.us)

ANY advice would be useful.

stampede
24th April 2011, 07:52
Is that a good or bad idea?
You should give it a try, you'll have access to the subclassed QListWidgetItem when you connect to "itemClicked()" signal from QListWidget, and dynamic_cast the passed QListWidgetItem pointer, so this should work.