[Qt-interest] simple tree model example

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Fri May 21 18:09:35 CEST 2010


Anyone? An inputs...at least on the Troll Q? :P

Thanks,
-mandeep


On Thu, May 20, 2010 at 4:32 PM, Mandeep Sandhu
<mandeepsandhu.chd at gmail.com> wrote:
> Hi All,
>
> While reading up the model-view programming docs, I came across the
> simple tree model example which illustrates how to use the abstract
> model for implementing a hierarchical tree like data (since there's no
> existing class (like QListview/QTableView) which can handle such
> category of data).
>
> http://doc.qt.nokia.com/4.6/itemviews-simpletreemodel.html
>
> While going through the other available model classes, I came across
> QStandardItemModel/QStandardItem which seems to be capable of holding
> tree like data structures.
>
> Is QStandardItemModel, the right model for holding tree-like data? If
> so, why wasn't this model used in the simple tree model?
>
> I have used QStandardItemModel populated with my tree data and applied
> a QTreeView to it and everything has worked fine till now.
>
> Just wondering why, in the simple tree model example, they used the
> QAbstractItermModel as base and not QStandardItemModel. The model-view
> programming guide states:
>
> "QStandardItemModel manages more complex tree structures of items,
> each of which can contain arbitrary data."
>
> Hence my confusion.
>
> Thanks,
> -mandeep
>
> PS: BTW one OT question - who are "Trolls"? ppl who work on QT itself?
> or anybody who uses QT, like app devs? Just curious. :)
>



More information about the Qt-interest-old mailing list