PDA

View Full Version : QListView multiSelection



cristiano
19th December 2006, 00:37
Hi guys,

I am using the QListView to select and to insert the data in the DataBase, however I only obtain to insert 1 item for time, would like to be able to select several items to insert everything of a time.

I am trying to more use "multiSelection" of the "QListView" without success.

Somebody knows if this is possible, link of form is here.

http://200.193.29.195/qt3/list.png

Cris.

wysota
19th December 2006, 01:38
Can we see some code?

cristiano
20th December 2006, 00:30
Yes,


void AvtrForm::selectViewItemVtr( QListViewItem *item )
{
btnInsertSalva->setEnabled(TRUE);

if (!item)
{
globalVtrFoo = QString::null;
return;

} else {

globalVtrFoo = item->text(0);
std::cout << "Test --> :" << globalVtrFoo << endl;
}
return;
}

wysota
20th December 2006, 00:41
You have to iterate over all items in the view and using QListView::isSelected(const QListViewItem*) check if each of the items is selected. Then you'll get a complete list of selected items and you can process them all.