get children of a listview
Unsolved
General and Desktop
-
I wrote:
int numero_children = _listView->children().count(); QList<QString> list; for (int i=0; i<numero_children; i++) { QModelIndex mi3 = index.child(i,0); QVariant data_child = _listView->model()->data(mi3); QString data_c = data_child.toString(); list.insert(i,data_child.toString()); }
but list is empty
-
Hope you are talking about QListView. What are looking for here as children of QListView ? What is the expectation ?
-
@dheerendra I click on a dir:
QModelIndex index = _listView->currentIndex();
and then I want find out what there is inside the dir...how must I write?
-
@vale88 Did you at least check the value of numero_children?
-
@vale88 What I wanted to know is the value of numero_children after executing this line of code
int numero_children = _listView->children().count();
If list is empty then the for loop was not executed.
-
@jsulm numero_children = 7
but numero_children must be 4, because inside I have a dir and 3 files, the for loop is executed, but I think I write bad this line:QVariant data_child = _listView->model()->data(mi3);
because data_child is invalid
-
in debug I have this
-