Re: [Interest] Model for QTreeView

2012-11-19 Thread Alex Strickland
To Jan and Andreas I have tested with ModelTest and it passes, but I think I have hacked my original model into insignificance, as the QTreeView certainly doesn't look like I want. I'm going to give it a bit of a rest, and try again later. Thank you both for your kind help. -- Regards Alex _

Re: [Interest] Model for QTreeView

2012-11-19 Thread Alex Strickland
On 2012/11/19 06:27 PM, Alex Strickland wrote: Yes, I have, but as you might judge from the above, it's still a bit hazy! My attempts don't work, can anyone say why? TIA -- Regards Alex /* * Copyright Electric Bridge Software 2011,2012. */ #include "treemodel.h" TreeModel::TreeModel() {

Re: [Interest] Model for QTreeView

2012-11-19 Thread Alex Strickland
On 2012/11/19 06:10 PM, Jan Kundrát wrote: > That's a rather strange tree -- you could only ever have a tree with at most > one level of nesting using this structure. It's a simplification of what I really want, but basically one level is fine. > Have you read the example [1] about how tree mo

Re: [Interest] Model for QTreeView

2012-11-19 Thread Alex Strickland
On 2012/11/19 04:41 PM, Alex Strickland wrote: Sorry, I should have shown the header: #include #include #include typedef struct TreeStruct { QString name; QList leaves; }; class TreeModel : public QAbstractItemModel { public: TreeModel(); QVariant data(const QModelIndex &

[Interest] Model for QTreeView

2012-11-19 Thread Alex Strickland
Hi I am trying to create a workable example of a very simple model to use with a QTreeView. Here is the underlying hierarchical data: TreeModel::TreeModel() { TreeStruct treeStruct; treeStruct.name = "one"; treeStruct.leaves << "one/one" << "one/two"; m_treeData << treeStruc