ui(new Ui::MainWindow)
{
itm->setText(0,"1");
itm->setFlags(itm->flags() | Qt::ItemIsUserCheckable);
itm->setCheckState(0,Qt::Checked);
AddChild(itm,"2");
AddChild(itm,"3");
AddChild(itm,"4");
}
{
itm->setText(0,title);
itm->setFlags(itm->flags() | Qt::ItemIsUserCheckable);
itm->setCheckState(0,Qt::Checked);
parent->addChild(itm);
}
void MainWindow
::on_treeWidget_itemChanged(QTreeWidgetItem *item,
int column
) {
//What do I put here?
}
QMainWindow(parent),
ui(new Ui::MainWindow)
{
QTreeWidgetItem *itm = new QTreeWidgetItem(ui->treeWidget);
itm->setText(0,"1");
itm->setFlags(itm->flags() | Qt::ItemIsUserCheckable);
itm->setCheckState(0,Qt::Checked);
AddChild(itm,"2");
AddChild(itm,"3");
AddChild(itm,"4");
}
void MainWindow::AddChild(QTreeWidgetItem *parent,QString title)
{
QTreeWidgetItem *itm =new QTreeWidgetItem();
itm->setText(0,title);
itm->setFlags(itm->flags() | Qt::ItemIsUserCheckable);
itm->setCheckState(0,Qt::Checked);
parent->addChild(itm);
}
void MainWindow::on_treeWidget_itemChanged(QTreeWidgetItem *item, int column)
{
//What do I put here?
}
To copy to clipboard, switch view to plain text mode
Bookmarks