QmlOutline: Cut down update times considerably

Cut down update times of Outline by a magnitude by only emitting
itemChanged signal if absolutely needed. This doesn't include the change
of the icon, because QIcon is missing a comparison operator ...
This commit is contained in:
Kai Koehne
2010-08-25 13:21:38 +02:00
parent 22fe4f584d
commit 6cf563bb25
4 changed files with 148 additions and 171 deletions

View File

@@ -882,7 +882,10 @@ void QmlJSTextEditor::modificationChanged(bool changed)
void QmlJSTextEditor::jumpToOutlineElement(int /*index*/)
{
QModelIndex index = m_outlineCombo->view()->currentIndex();
AST::SourceLocation location = index.data(QmlOutlineModel::SourceLocationRole).value<AST::SourceLocation>();
AST::SourceLocation location = m_outlineModel->sourceLocation(index);
if (!location.isValid())
return;
Core::EditorManager *editorManager = Core::EditorManager::instance();
editorManager->cutForwardNavigationHistory();
@@ -1753,7 +1756,7 @@ QModelIndex QmlJSTextEditor::indexForPosition(unsigned cursorPosition, const QMo
const int rowCount = m_outlineModel->rowCount(rootIndex);
for (int i = 0; i < rowCount; ++i) {
QModelIndex childIndex = m_outlineModel->index(i, 0, rootIndex);
AST::SourceLocation location = childIndex.data(QmlOutlineModel::SourceLocationRole).value<AST::SourceLocation>();
AST::SourceLocation location = m_outlineModel->sourceLocation(childIndex);
if ((cursorPosition >= location.offset)
&& (cursorPosition <= location.offset + location.length)) {