Commit 9f6cfe48 authored by hjk's avatar hjk
Browse files

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: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent 87b99545
...@@ -682,6 +682,7 @@ void TreeItem::appendChild(TreeItem *item) ...@@ -682,6 +682,7 @@ void TreeItem::appendChild(TreeItem *item)
void TreeItem::insertChild(int pos, TreeItem *item) void TreeItem::insertChild(int pos, TreeItem *item)
{ {
QTC_CHECK(!item->model());
QTC_CHECK(!item->parent()); QTC_CHECK(!item->parent());
QTC_ASSERT(0 <= pos && pos <= m_children.size(), return); // '<= size' is intentional. QTC_ASSERT(0 <= pos && pos <= m_children.size(), return); // '<= size' is intentional.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment