On Tue, Feb 7, 2012 at 10:22 PM, Aaron Richiger <[email protected]> wrote:
> Hello Jun!
>
> As other suggested, model.rowsInserted(parent, start, end).emit() is the
> signal you need. To show you the way one could do this, I shortly changed
> the Simple Tree View example of PySide (quick and dirty, I know, but it
> shows enough)... You may add new items filling in the LineEdits and then
> clicking the button. The only magic line is the last one of the method
> TreeModel.addData().
>
.....
>    model = TreeModel(rootItem)
>    model.addData(data, rootItem)

with this awesome demo, i can add a new data to the view with
TreeModel.addData(), like in the code you wrote above.

for example, i created a new tree node like this:

....
NewData


now, if i want to create a subnode for NewData, so it will be like this:

....
NewData
    |____ MyChildData


i guess to do that, again i need to use TreeModel.addData(), but the
difference is that this time i need the model of NewData, so it will
create a subnode, but not the model of the TreeView (the root) like
when i created NewData

so the question is: how can i get the model of the NewData i created above?
(i suppose that i need to modify the addData() function, so it returns
the model of the newly created node, but i have no idea how to do
that)

thanks a lot,
Jun
_______________________________________________
PySide mailing list
[email protected]
http://lists.pyside.org/listinfo/pyside

Reply via email to