Hello!
I'm trying for some time to find a way to remove an item from a QTreeWidget but I'm unsucessfull. Here is the way I add a item to the QTreeWidget:
{
itm->setText(0,data);
itm2->setText(0,semana);
itm2->setText(1,hora);
itm2->setText(2,smadesc);
itm->addChild(itm2);
}
void AlarmManagment::addRoot(QString data, QString semana, QString hora, QString smadesc)
{
QTreeWidgetItem *itm = new QTreeWidgetItem(ui->Listofalarms);
itm->setText(0,data);
QTreeWidgetItem *itm2 = new QTreeWidgetItem();
itm2->setText(0,semana);
itm2->setText(1,hora);
itm2->setText(2,smadesc);
itm->addChild(itm2);
}
To copy to clipboard, switch view to plain text mode
No imagine that, in another function, I want to delete that itm2 or even itm. How do I do?
And second, regarding the metho removeChild(), I would like to know how can I say that that method which QTreeWidgetItem I want to remove if, as you may have seen in the previous code, I create and add a QTreeWidgetItem inside a method, not as a global variable.
Thanks!
Momergil
Bookmarks