TreeModel: Fix model back pointer propagation when adding items

Only the top level entry was handled so far, but we might add
items with subitems.

Change-Id: I55084a1f595f4982bd37168e71b144b17eee63b1
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
hjk
2015-01-28 14:49:37 +01:00
parent 706c826bc1
commit 999a11a745

View File

@@ -695,7 +695,7 @@ void TreeItem::insertChild(int pos, TreeItem *item)
QModelIndex idx = index(); QModelIndex idx = index();
m_model->beginInsertRows(idx, pos, pos); m_model->beginInsertRows(idx, pos, pos);
item->m_parent = this; item->m_parent = this;
item->m_model = m_model; item->propagateModel(m_model);
m_children.insert(m_children.begin() + pos, item); m_children.insert(m_children.begin() + pos, item);
m_model->endInsertRows(); m_model->endInsertRows();
} else { } else {