Commit 133af73b authored by Christian Stenger's avatar Christian Stenger
Browse files

TreeModel: Ensure that proxy models or views get notified...

...when the root item is exchanged.

Change-Id: Ic854259902bcfdcf5ec5776ad40b56bca3820bf5
Reviewed-by: default avatarhjk <>
parent e57b0db0
......@@ -967,9 +967,14 @@ void TreeModel::setRootItem(TreeItem *item)
QTC_ASSERT(item->m_model == 0, return);
QTC_ASSERT(item->m_parent == 0, return);
emit layoutAboutToBeChanged();
if (m_root) {
QTC_CHECK(m_root->m_parent == 0);
QTC_CHECK(m_root->m_model == this);
// needs to be done explicitly before setting the model to 0, otherwise it might lead to a
// crash inside a view or proxy model, especially if there are selected items
m_root->m_model = 0;
delete m_root;
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