PDA

View Full Version : Qt list help



shabir_24
17th September 2010, 12:12
heyy guys... i have a list of employee object (id , name , rate)... i want to convert it into a Qlist... so i can list those employees data into a listWidget ( addItems(cont QstringList &labels) ).... i really need some help here... i dnt have any idea of how to do this conversion....

tbscope
17th September 2010, 14:22
You can not use a listwidget since it only contains a single column.
Use a treewidget

And use the examples and documentation.

MTK358
17th September 2010, 16:07
Again, you must use a tree widget, as list widgets can only show one column.

Anyway, just iterate over the objects with a loop, and add the rows in there. See the QTreeWidget documentation to find out how.