if (ui.treeWidget->currentItem()->parent()){index = ui.treeWidget->currentItem()->parent()->indexOfChild(ui.treeWidget->currentItem());delete ui.treeWidget->currentItem()->parent()->takeChild(index);} else{index = ui.treeWidget->indexOfTopLevelItem(ui.treeWidget->currentItem());delete ui.treeWidget->takeTopLevelItem(index);}
QMessageBox::information(this, QString( "Current Internal Id" ), QString::number( treeWidget->currentIndex().internalId() ) );
QTreeWidgetItemIterator it (ui.treeWidget);while (*it) { ui.treeWidget->setCurrentItem((*it)); int id = ui.treeWidget->currentIndex().internalId(); //уникальный номер ++it; }