QTreeWidgetItem* childItem = parentItem->takeChild(0);
while (parentItem->childCount() > 0) { delete parentItem->takeChild(0); }In this example, parentItem is a pointer to the parent item in the tree and the while loop removes and deletes all child items until there are none left. Package library: Qt C++ Library.