#include <QtGui/QTreeWidget>#include <QtGui/QCheckBox>#include <QtGui/QRadioButton>Tree::Tree(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags){ ui.setupUi(this); ui.treeWidget->setColumnCount(1); QTreeWidgetItem* pItem; pItem = addItem("1"); pItem = addItem("2"); QTreeWidgetItem* pW01 = addItem(pItem, ""); QTreeWidgetItem* pW02 = addItem(pItem, ""); QTreeWidgetItem* pW03 = addItem(pItem, ""); QTreeWidgetItem* pW04 = addItem(pItem, ""); pItem = addItem("3"); ui.treeWidget->setItemWidget(pW01, 0, new QCheckBox("First property")); ui.treeWidget->setItemWidget(pW02, 0, new QCheckBox("Second Property")); ui.treeWidget->setItemWidget(pW03, 0, new QRadioButton("QRadioButton")); ui.treeWidget->setItemWidget(pW04, 0, new QRadioButton("QRadioButton"));}QTreeWidgetItem* Tree::addItem(QString name){ QStringList lst; lst << name; QTreeWidgetItem* pItem = new QTreeWidgetItem(ui.treeWidget, lst, 0); return pItem;}QTreeWidgetItem* Tree::addItem(QTreeWidgetItem* item, QString name){ QStringList lst; lst << name; QTreeWidgetItem* pItem = new QTreeWidgetItem(item, lst, 0); return pItem;}
QLineEdit* L;QString buf;int i;for(i=0;i<treeWidget->topLevelItemCount();i++){ L = (QLineEdit*)treeWidget->itemWidget(treeWidget->topLevelItem(i),6); buf = L->text(); // на этой строке прога вылетает ........ // чего-то там}