Hello i have a small problem... I am populating a QListWidget with some names like name1 to name300, now when i select a few names from this list say from name1 to name5 and name45 to name80 , i need to create a relavent TagId some thing like TAGID_1 for the selected items in ListWidget.. I was thinking if i know the row id's of the selected names in the ListWidget i can append that row id number to the TagId and i could get the right sequence in how i have selected the items in the ListWidget.
QList<QListWidgetItem *>item = NewLISTLW->selectedItems(); // NewLISTLW is Obj name for ListWidget 1
for(kfast = 0;kfast<item.count();kfast++)//insert selected items from list to selected another list.
{
SelectedLW->insertItem(kfast,item1); // SelectedLWis Obj name for ListWidget 2
selectedlist.append(SelctdPresParamsLW->item(kfast)->text());
}
for(int k=0; k< selectedlist.count(); k++)
{
tagidnames.
append(QString("TAGID_%1").
arg(k
));
// QVector<QString> selectedlist,tagidnames;}
qDebug() << tagidnames;
QList<QListWidgetItem *>item = NewLISTLW->selectedItems(); // NewLISTLW is Obj name for ListWidget 1
for(kfast = 0;kfast<item.count();kfast++)//insert selected items from list to selected another list.
{
QListWidgetItem * item1 = new QListWidgetItem(item[kfast]->text());
SelectedLW->insertItem(kfast,item1); // SelectedLWis Obj name for ListWidget 2
selectedlist.append(SelctdPresParamsLW->item(kfast)->text());
}
for(int k=0; k< selectedlist.count(); k++)
{
tagidnames.append(QString("TAGID_%1").arg(k)); // QVector<QString> selectedlist,tagidnames;
}
qDebug() << tagidnames;
To copy to clipboard, switch view to plain text mode
but here the TAGID is created for how many items are selected not in relation with rowid.
if i select name1 to name5 and name45 to name50 instead of creating TAGID1 to TAGID5 and TAGID45 to TAGID50 .. i can see from TAGID1 to TAGID10.. how can i use the selected row id to get what i want here.. ?
thank you
Bookmarks