Hi all!
I have created a custom model subclassing a QAbstractItemModel and inserted items with the following code:
QTreeNode* root = new QTreeNode("Root", 0);
QTreeNode* n1 = new QTreeNode("N1", root);
QTreeNode* n2 = new QTreeNode("N2", root);
QTreeNode* n21 = new QTreeNode("N21", n2);
QTreeNode* n22 = new QTreeNode("N22", n2);
QTreeNode* n23 = new QTreeNode("N23", n2);
QTreeNode* n3 = new QTreeNode("N3", root);
QTreeModel* model = new QTreeModel(this);
model->setRootNode(root);
treeFolders->setRootIsDecorated(true);
treeFolders->setModel(model);
QTreeNode* root = new QTreeNode("Root", 0);
QTreeNode* n1 = new QTreeNode("N1", root);
QTreeNode* n2 = new QTreeNode("N2", root);
QTreeNode* n21 = new QTreeNode("N21", n2);
QTreeNode* n22 = new QTreeNode("N22", n2);
QTreeNode* n23 = new QTreeNode("N23", n2);
QTreeNode* n3 = new QTreeNode("N3", root);
QTreeModel* model = new QTreeModel(this);
model->setRootNode(root);
treeFolders->setRootIsDecorated(true);
treeFolders->setModel(model);
To copy to clipboard, switch view to plain text mode
What I get as result is:
|-N1
|-N2
| |-N21
| |-N22
| |-N23
|-N3
How can I manage to get it this way:
Root
|-N1
|-N2
| |-N21
| |-N22
| |-N23
|-N3
I have attached a file containing my model implementation if needed for
further examination.
Thanks in advance!
Bookmarks