0

Normally for QTreeView component, with the code below we will get something like this

    QStandardItemModel *model = new QStandardItemModel(this->ui->treeView);
    model->setColumnCount(1);

    QStandardItem* parentItem = new QStandardItem("Parent Node");
    QStandardItem* childItem = new QStandardItem("Child Node");

    parentItem->appendRow(childItem);
    model->appendRow(parentItem);

    this->ui->treeView->setModel(model);
▽ Parent Node
  O Circle Node

My question is: are we able to set the parent node icon at right like this without building my own QTreeView class?

Parent Node          ▽ 
  O Circle Node

Like using stylesheet or something?

I've tried using setLayoutDirection or setIndentation, none of them can do this.

Hellagur
  • 93
  • 7
  • This question seems to be a duplicate of [How to create a custom TreeView in qt with branches put at right side of the ItemView?](https://stackoverflow.com/questions/59212093/how-to-create-a-custom-treeview-in-qt-with-branches-put-at-right-side-of-the-ite) – Atmo Feb 14 '23 at 11:39

0 Answers0