TreeModel: Assert when inserting items that already have a model

Makes the assumption Item::m_model != 0 if and only if item belongs
to a model explicit.

Change-Id: Ib58889fd10e9fce1590a42ade6d847aee747ac56
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
hjk
2015-07-03 14:21:30 +02:00
parent 87b9954534
commit 9f6cfe4803

View File

@@ -682,6 +682,7 @@ void TreeItem::appendChild(TreeItem *item)
void TreeItem::insertChild(int pos, TreeItem *item)
{
QTC_CHECK(!item->model());
QTC_CHECK(!item->parent());
QTC_ASSERT(0 <= pos && pos <= m_children.size(), return); // '<= size' is intentional.