23 QModelIndex modelIndexFromNode(
node_type& n,
int column)
const
31 SCORE_ASSERT(n.parent());
32 return createIndex(n.parent()->indexOfChild(&n), 0, &n);
38 SCORE_ASSERT(parent != &rootNode());
40 return createIndex(parent->indexOfChild(&n), column, &n);
46 QModelIndex parentIndex = modelIndexFromNode(parentNode, 0);
48 beginInsertRows(parentIndex, row, row);
50 auto it = parentNode.begin();
51 std::advance(it, row);
52 parentNode.emplace(it, other, &parentNode);
57 auto removeNode(node_type::const_iterator node)
65 SCORE_ASSERT(parent != &rootNode());
66 node_type* grandparent = parent->parent();
67 SCORE_ASSERT(grandparent);
68 int rowParent = grandparent->indexOfChild(parent);
69 QModelIndex parentIndex = createIndex(rowParent, 0, parent);
71 int row = parent->indexOfChild(&*node);
73 beginRemoveRows(parentIndex, row, row);
74 auto it = parent->erase(node);
81 int row = rootNode().indexOfChild(&*node);
83 beginRemoveRows(QModelIndex(), row, row);
84 auto it = rootNode().erase(node);