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:
Kai Koehne
2010-10-20 11:52:54 +02:00
parent 3cd32effdd
commit ac263ef261

View File

@@ -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();
} }