forked from qt-creator/qt-creator
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:
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user