0

There is a method

void QStandardItemModel::appendRow(QStandardItem * item)

in class QStandardItemModel. I cannot figure out where the item is appended, or who the item's parent is after appending?

And another method

bool QStandardItemModel::insertRow(int row, const QModelIndex & parent = QModelIndex())

shows the parent but which item will be appended to the parent?

Mat
  • 202,337
  • 40
  • 393
  • 406
user1899020
  • 13,167
  • 21
  • 79
  • 154

1 Answers1

0

The first question is easy. As the name says: Append. It is appended to a list or a tree, which has only one column.

The second one is difficult. This function is not directly about inserting items, but about the algorithm how to insert items. In a complicated tree this is not a necessarily trivial task. Adding nodes, changing the dimension of a tree. You have to implement this virtual method, when you have to create an editable tree. In that case making room for a new item and actually inserting the item are two different tasks.

Greenflow
  • 3,935
  • 2
  • 17
  • 28