Traverse wTreeView
Added by Gerald Brandt almost 3 years ago
I have a WTreeView, and I would like to change the associated icon of some entries. I think I'm missing something, because I can't figure out our to traverse the tree view/model to call setIcon() on it.
I have no issues getting to the first level of the treeview, but the 2nd level, etc, I can't seem to get access.
first level
|
---- second level
|
---- third level
How would I go about geting the WStandardItem entry of 'second level' or 'third level' in order to change the con?
Replies (1)
RE: Traverse wTreeView - Added by Roel Standaert almost 3 years ago
In a WStandardItemModel
, the rows on the second level can be accessed from the WStandardItem
in the first column of the first level, so:
auto first_level = model->item(0, 0);
auto second_level = first_level->child(0, 0);
auto third_level = second_level->child(0, 0);