Hi, this is my first post to the forum. I have an application that queries for data on a network. Then populates a QStandardItemModel in the following fashion;
QStandardItemItem * parentItem = model->invisibleRootItem();
QStandardItemModel * model = new QStandardItemModel;
QStandardItemItem * parentItem = model->invisibleRootItem();
To copy to clipboard, switch view to plain text mode
I iterate over my data instantiating new child items to be added to the model.
parentItem->setChild(row,column,item);
QStandardItem * item = new QStandardItem();
item->setData(QVariant("some data"));
parentItem->setChild(row,column,item);
To copy to clipboard, switch view to plain text mode
Now the data is in the model, I have gone through it and written the data back out to the console.
Next I set the model in my treeview in this way;
treeView->setModel(model);
treeView->setRootIndex(index);
treeVeiw->setCurrentIndex(currentIndex);
treeView->setRootIndex(index);
treeView->setModel(model);
QStandardItem * parentItem = model->invisibleRootItem();
QModelIndex index = parentItem->index();
treeView->setRootIndex(index);
QModelIndex currentIndex = model->index(0,0);
treeVeiw->setCurrentIndex(currentIndex);
treeView->setRootIndex(index);
To copy to clipboard, switch view to plain text mode
When the application runs and I get to the page with the treeview display, I see the model column header labels but no data.
I don't understand why I don't see the data, any assistance would be appreciated.
thanks
Bookmarks