forked from qt-creator/qt-creator
QmlOutline: Speed up updates
Guard the incremental updates with beginResetModel/endResetModel This gives better overall performance then passing the incremental updates to the views. Tested-by: Lasse Holmstedt
This commit is contained in:
@@ -367,6 +367,10 @@ void QmlOutlineModel::update(const SemanticInfo &semanticInfo)
|
|||||||
m_treePos.append(0);
|
m_treePos.append(0);
|
||||||
m_currentItem = invisibleRootItem();
|
m_currentItem = invisibleRootItem();
|
||||||
|
|
||||||
|
// resetModel() actually gives better average performance
|
||||||
|
// then the incremental updates.
|
||||||
|
beginResetModel();
|
||||||
|
|
||||||
m_typeToIcon.clear();
|
m_typeToIcon.clear();
|
||||||
m_itemToNode.clear();
|
m_itemToNode.clear();
|
||||||
m_itemToIdNode.clear();
|
m_itemToIdNode.clear();
|
||||||
@@ -376,6 +380,8 @@ void QmlOutlineModel::update(const SemanticInfo &semanticInfo)
|
|||||||
QmlOutlineModelSync syncModel(this);
|
QmlOutlineModelSync syncModel(this);
|
||||||
syncModel(m_semanticInfo.document);
|
syncModel(m_semanticInfo.document);
|
||||||
|
|
||||||
|
endResetModel();
|
||||||
|
|
||||||
emit updated();
|
emit updated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user