Quote Originally Posted by ttvo View Post
Thanks. I currently have the following code
Qt Code:
  1. QStandardItem *parentItem = new QStandardItem(QIcon("C:\\dataset_small.png"), "Authors");
  2. model->appendRow(parentItem);
  3. QStandardItem *author1 = new QStandardItem(QIcon("C:\\dataset_small.png"), "Smith, V");
  4. author1->setCheckable(true);
  5. parentItem->appendRow(author1);
  6. parentItem->appendRow(new QStandardItem(QIcon("C:\\dataset_small.png"), "Campbell, C"));
  7. for (int i = 0; i < 3; ++i) {
  8. QStandardItem *item = new QStandardItem(QIcon("C:\\dataset_small.png"), QString("Book # %0").arg(i+1));
  9. item->setCheckable(true);
  10. author1->insertRow(i, item);
  11. }
  12. ui.treeView->setModel(model);
To copy to clipboard, switch view to plain text mode 
producing the attached image. Remaining things are:
1) I like the checkbox for the author node, but I'd like to have the radio button for the book items to force only one book can be selected at the time. Could you please elaborate on the QItemDelegate?
2) I also want to have a count of children next to the labels meaning I want to have a "2" next to the "Authors" string (since there are 2 authors) and a "3" next to "Smith, V" because he has 3 books


hey ...What About TreeView Qml Type