How can I make this:
|-parent0
--child0
--child1
|-parent1
The code for adding the parents is
Code:
and for the childs?
I have this and I'm not sure that it's working:
Thanks
Printable View
How can I make this:
|-parent0
--child0
--child1
|-parent1
The code for adding the parents is
Code:
and for the childs?
I have this and I'm not sure that it's working:
Thanks
What do you mean you are not sure if that's working? Can you see the child0 item or not?
Hmm, if you are not sure, if it's working, why don't you simply try and see if it's working:confused: And beside, a look into the docs are always good:Quote:
An example usage of QStandardItemModel to create a tree:Code:
QStandardItemModel model; for (int i = 0; i < 4; ++i) { parentItem->appendRow(item); parentItem = item; }
In fact, I'm trying to test it, but I cant see it :(
And... my code is a little bit different.
I have a QStandardItemModel with 5 columns per item. 2 and 3 column are ID's.
Code:
item = self.__search_by_id(id) #this will return a QStandardItem matching the ID arg
I cant see the childs... Maybe I'm doing something wrong? (doc's says that everything is fine)
I'm not sure how appending a null would work... There should be 5 items here, some of them may be empty but they should still be there. And I think you need to tell the parent item that its children are to have 5 columns - it's not enough to do that on the top-level.
Mmm, ok, so... how could I do that? could you give me an example or a link? (link != pyqt docs if possible, I already have that one xD)
To do what exactly? To set the column count of children to 5? QStandardItem::setColumnCount()
nm, I did it :)
It was just simple as
child.appendRow([.....])
But thanks anyway!