I am using QStandardItemModel with QStandardItem's.
I don't want to write my own model and any delegates.
I just want to have tree of checkboxes with QComboBox'es in second column...
m_model->setColumnCount(2);
for (int i = 0; i < sectionCount; i++)
{
QStandardItem * section = new QStandardItem(tr("Section %1").arg(i+1));
section->setCheckable(true);
section->setCheckState(Qt::Checked);
for (int j = 0; j < itemsCount; j++)
{
QStandardItem * item = new QStandardItem(tr("Item %1").arg(j+1));
item->setCheckable(true);
item->setCheckState(Qt::Checked);
QStandardItem * item2 = new QStandardItem("xxx");
section->appendRow(QList<QStandardItem*>() << item << item2);
QComboBox * combo = new QComboBox();
QModelIndex index = m_model->index(j, 1, );
// HERE i have index = {-1;-1}
ui->treeView_options->setIndexWidget(index, combo);
}
m_model->appendRow(section);
}
Is it possible to use setIndexWidget this way?
UPDATE:
I have no QComboBox in second column... Why?