C++ (Qt)QTreeWidgetItem* item;int column = item->columnCount();int n_childrens = item->childCount(); switch (item->checkState(0)) { case (Qt::Unchecked): break; case (Qt::PartiallyChecked): break; case (Qt::Checked): for (int i = 0; i < n_childrens; i++) { QTreeWidgetItem *subItem = item->child(i); QString child = subItem->text(i); ui->textEdit->insertPlainText(child); } break; }}
The program has unexpectedly finished.
QTreeWidgetItem* item;
C++ (Qt)QTreeWidgetItem *item = new QTreeWidgetItem(ui->treeWidget);
QTreeWidgetItem *item = ui->treeWidget->invisibleRootItem()
C++ (Qt)QTreeWidgetItem *item = ui->treeWidget->invisibleRootItem()->child(i);
C++ (Qt)QString child_text;for(int i=0; i<ui->treeWidget->invisibleRootItem()->childCount(); ++i){QTreeWidgetItem *item = ui->treeWidget->invisibleRootItem()->child(i); if (item->checkState(0) == Qt::Checked){ for (int j = 0; j < item->childCount(); ++j) { QTreeWidgetItem *subItem = item->child(j); child_text += subItem->text(0) + "\n"; } }}ui->textEdit->insertPlainText(child_text);
C++ (Qt)QString child_text;for(int i=0; i < ui->treeWidget->invisibleRootItem()->childCount(); ++i){QTreeWidgetItem *item = ui->treeWidget->invisibleRootItem()->child(i); if (item->checkState(0) == Qt::Checked||Qt::PartiallyChecked){ for (int j = 0; j < item->childCount(); ++j) { QTreeWidgetItem *subItem = item->child(j); if (subItem->checkState(0) == Qt::Checked) { child_text += subItem->text(0) + "\n"; } } }}ui->textEdit->insertPlainText(child_text);