问题
I understand that QTreeWidget
has methods for finding an item, but since I want to use a QFileSystemModel
, then I'm limited to QTreeView
. However, I'd still like to be able to return all items from a QTreeView
and place them into a list.
I had thought that I could go through and grab all indexes from the QTreeView
, but I'm not sure how to do that.
Maybe something like:
QList<QModelIndex &> treeList;
foreach(QModelIndex &index, ui->tv_list)
{
treeList.append(index);
}
but I know this isn't correct. What is a good way to get the items or addresses of items into a list from a QTreeView
?
来源:https://stackoverflow.com/questions/15196207/how-to-find-an-item-in-a-qtreeview