Re: [Interest] Design Issue with QAbstractItemModel & QTreeView

2016-08-06 Thread André Somers
You might look to QFilwSystemModel for inspiration. André Verstuurd vanaf mijn iPhone > Op 4 aug. 2016 om 18:48 heeft Sébastien Le Ray het > volgende geschreven: > > Hi list, > > I'm currently designing an application which presents its data in a tree. I > have a

Re: [Interest] Design Issue with QAbstractItemModel & QTreeView

2016-08-05 Thread Sébastien Le Ray
Le 05/08/2016 à 17:47, j...@wavemetrics.com a écrit : When you say "packaging", you mean that you have a wrapper around the underlying data (something like a TreeItem class that "caches" data) I mean preparing the presentation of the data. Which mean? :D Main issue is not on adding rows

Re: [Interest] Design Issue with QAbstractItemModel & QTreeView

2016-08-05 Thread john
> When you say "packaging", you mean that you have a wrapper around the > underlying data (something like a TreeItem class that "caches" data)? I mean preparing the presentation of the data. > Main issue is not on adding rows (this you can indeed call begin while data > is already added),

Re: [Interest] Design Issue with QAbstractItemModel & QTreeView

2016-08-04 Thread John Weeks
> But when childAdded is called… child already has been added. That's the > issue, model is not manipulating data, it's just supposed to react on their > changes OK, I finally decided to look at our code and the documentation :) QAbstractItemModel has protected functions beginInsertRows and

Re: [Interest] Design Issue with QAbstractItemModel & QTreeView

2016-08-04 Thread Sébastien Le Ray
Le 04/08/2016 à 23:34, John Weeks a écrit : On Aug 4, 2016, at 2:19 PM, Sébastien Le Ray wrote: That's what I do, but the signal says childAdded, where model needs childWillBeAdded and childHasBeenAdded to handle beginInsertRows/endInsertRows, same for the removal

Re: [Interest] Design Issue with QAbstractItemModel & QTreeView

2016-08-04 Thread John Weeks
> On Aug 4, 2016, at 2:19 PM, Sébastien Le Ray wrote: > > That's what I do, but the signal says childAdded, where model needs > childWillBeAdded and childHasBeenAdded to handle > beginInsertRows/endInsertRows, same for the removal so that's not working. > Worst case

Re: [Interest] Design Issue with QAbstractItemModel & QTreeView

2016-08-04 Thread Sébastien Le Ray
Hi, Thanks for the pointer (guess I already read it while searching). The second answer is what I'm currently heading toward but that's quite cumbersome Le 04/08/2016 à 22:20, Bernhard Lindner a écrit : I have seen that problem before: http://stackoverflow.com/q/36412671/1421332

Re: [Interest] Design Issue with QAbstractItemModel & QTreeView

2016-08-04 Thread Sébastien Le Ray
Le 04/08/2016 à 20:45, Igor Mironchik a écrit : Hi, On 04.08.2016 20:52, Sébastien Le Ray wrote: Hi Thanks for your answer I know about xxxInsertRow but these are meant to be called by the model (or at least by a class that has knowledge of the model). The question is how to properly call

Re: [Interest] Design Issue with QAbstractItemModel & QTreeView

2016-08-04 Thread Bernhard Lindner
I have seen that problem before: http://stackoverflow.com/q/36412671/1421332 Unfortunately no answer there too. > I'm not sure what are you talking about. But what about > beginInsertRows() and endInsertRows()? Between this methods you should > add new data, and this data can has child rows. >

Re: [Interest] Design Issue with QAbstractItemModel & QTreeView

2016-08-04 Thread Igor Mironchik
Hi, On 04.08.2016 20:52, Sébastien Le Ray wrote: Hi Thanks for your answer I know about xxxInsertRow but these are meant to be called by the model (or at least by a class that has knowledge of the model). The question is how to properly call it when the only notification you get from the

Re: [Interest] Design Issue with QAbstractItemModel & QTreeView

2016-08-04 Thread Sébastien Le Ray
Hi Thanks for your answer I know about xxxInsertRow but these are meant to be called by the model (or at least by a class that has knowledge of the model). The question is how to properly call it when the only notification you get from the data is "this row was added|removed". Regards Le

Re: [Interest] Design Issue with QAbstractItemModel & QTreeView

2016-08-04 Thread Igor Mironchik
Hi, I'm not sure what are you talking about. But what about beginInsertRows() and endInsertRows()? Between this methods you should add new data, and this data can has child rows. What is the problem? On 04.08.2016 19:48, Sébastien Le Ray wrote: Hi list, I'm currently designing an

[Interest] Design Issue with QAbstractItemModel & QTreeView

2016-08-04 Thread Sébastien Le Ray
Hi list, I'm currently designing an application which presents its data in a tree. I have a QAbstractItemModel making a bridge between these data and the view, so far so good. However I'm stuck when it comes to react to underlying data structure changes, specifically when rows are added and