Hi,
I want to add items dynamically to QListWidget in Qt.
I have used the following piece of code to add items dynamically, but I am able to add only one item in QListWidget...
for(int i=0; i<5; i++)
{
structLocationDetails[i].strlocationName = metaresult["locationName"];
QString strtemp = structLocationDetails[i].strlocationName;
list=new QListWidget(this);
list->setSortingEnabled(true);
list->setGeometry(0,0,190, 450);
QStringList items;
item1=new QListWidgetItem(QIcon(":/imagesIcon.png"),structLocationDetails[i].strlocationName,list);
connect(list,SIGNAL(itemClicked(QListWidgetItem*)),this,SLOT(myitem(QListWidgetItem*)));
}
Here actually I am parsing an XML file and trying to add the parsed xml file contents(locationName) to the QListWidget.
How can I achieve this?
Please provide me any suggestions on this...
Thanks...