rrafluap
13th December 2010, 19:49
Hey, im trying to get the selected items of a treeview using the qitemselectionmodel... the treeview has the file listing already (using qfilesystemmodel) but when i use my code i get 4 entries back (for each entry clicked) i understand that each item returned has 4 of its own items like name, size etc...
so basically if one item is selected a 1x4 entry should be added in the list but instead i get 4x4... and this carries on for each additional selected item... 8x4 etc...
QItemSelectionModel *selectionModel = ui->tree->selectionModel();
QModelIndexList indexes = selectionModel->selectedIndexes();
QModelIndex index;
list = new QList<QFileInfo>;
foreach(index, indexes) {
*list << model->fileInfo(index);
}
where am i going wrong?? ?(
any help would be appreciated! :)
Thanks, Paul.
so basically if one item is selected a 1x4 entry should be added in the list but instead i get 4x4... and this carries on for each additional selected item... 8x4 etc...
QItemSelectionModel *selectionModel = ui->tree->selectionModel();
QModelIndexList indexes = selectionModel->selectedIndexes();
QModelIndex index;
list = new QList<QFileInfo>;
foreach(index, indexes) {
*list << model->fileInfo(index);
}
where am i going wrong?? ?(
any help would be appreciated! :)
Thanks, Paul.