Hello guys, I have a problem inserting items to a tree widget!
Some info about the (attached) screenshot now, 'list' is declared as
QList<QTreeWidgetItem*> list;
Also,
qDebug() << parnt->text(i-2);
list.insert(i-2,parnt);
qDebug() << parnt->text(i-2);
list.insert(i-2,parnt);
To copy to clipboard, switch view to plain text mode
are inside a for loop, while
ui->treeWidget->addTopLevelItems(list)
ui->treeWidget->addTopLevelItems(list)
To copy to clipboard, switch view to plain text mode
is outside it.
When I output the parnt at 'i-2' as you can see, it does echo
2011 May
2011 October
2011 May
2011 October
To copy to clipboard, switch view to plain text mode
At the exact next line I insert the parnt to the 'list' at 'i-2' (the exact point I echoed parnt to the previous line)
But as you can see in the window besides it, it inserts '2011 May' 2 times, and I don't know why!
Also, mention that
insert.at(i-2)->addChild/addChilds(parnt);
insert.at(i-2)->addChild/addChilds(parnt);
To copy to clipboard, switch view to plain text mode
crashes my application, so I cannot use them (I don't know why).
Thx in advance for any answer/help!
error.png
Bookmarks