I am trying to implement QTreeWidget in my application. I am having problem in adding items in the QTreeWidget. The code below only display the number of columns in the tree (see the image below) but not the items that I have added.
Could anybody tell me what am I doing wrong with the following code?
ui->treeWidget_BE->setColumnCount(2);
QTreeWidgetItem *itemHW = new QTreeWidgetItem();
itemHW->setText(0,"Hello");
itemHW->setText(1,"World");
ui->treeWidget_BE->addTopLevelItem(itemHW);
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(0,"toto");
item->setText(0,"jojo");
itemHW->addChild(item);;
I have also tried the first 4 lines with the following code
QTreeWidgetItem *itemHW = new QTreeWidgetItem(ui->treeWidget_BE);
itemHW->setText(0,"Hello");
itemHW->setText(1,"World");
Thank you
PS: I am using Qt 4.8.3, Qt Designer and Visual Studio 2008