Slight change leads to segmentation fault in qt example
Hello.
I have just compiled the simpetreemodel example that comes with the qt sources. That worked fine.
But this slight change to the treemodel constructor (the last two lines with the x variable) gives me a segmentation fault. Does anyone know why? To me it is a mystery and I must have failed to understand something very basic?
Code:
{
QList<QVariant> rootData;
rootData << "Title" << "Summary";
rootItem = new TreeItem(rootData);
setupModelData
(data.
split(QString("\n")), rootItem
);
TreeItem* x = new TreeItem(rootData);
rootItem->appendChild(x);
}
I should add that I just wanted to try to add an extra item. But it seems that did not work.