QmlDesigner: Fix crumble bar

Change-Id: I8eefba1b5b9839b28be5dbae379366714f40ed27
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
Thomas Hartmann
2013-02-06 13:12:55 +01:00
parent 66ddcb54c2
commit a17f96d42a
8 changed files with 50 additions and 48 deletions

View File

@@ -236,7 +236,7 @@ QList<RewriterView::Error> DesignDocument::qmlSyntaxErrors() const
bool DesignDocument::hasQmlSyntaxErrors() const
{
return !m_currentModel->rewriterView()->errors().isEmpty();
return m_currentModel->rewriterView() && !m_currentModel->rewriterView()->errors().isEmpty();
}
QString DesignDocument::displayName() const
@@ -314,26 +314,18 @@ void DesignDocument::loadDocument(QPlainTextEdit *edit)
m_documentLoaded = true;
}
static const QString fileNameOfCurrentDocument()
{
return QmlDesignerPlugin::instance()->documentManager().currentDesignDocument()->textEditor()->document()->fileName();
}
void DesignDocument::changeCurrentModelTo(const ModelNode &node)
{
if (QmlDesignerPlugin::instance()->currentDesignDocument() != this)
return;
if (rootModelNode() == node) {
changeToDocumentModel();
} else {
changeToSubComponent(node);
}
// s_clearCrumblePath = false;
// while (m_formEditorView->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>().modelNode.isValid() &&
// !m_formEditorView->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>().modelNode.isRootNode())
// m_formEditorView->crumblePath()->popElement();
// if (node.isRootNode() && m_formEditorView->crumblePath()->dataForLastIndex().isValid())
// m_formEditorView->crumblePath()->popElement();
// s_clearCrumblePath = true;
changeToSubComponent(node);
}
void DesignDocument::changeToSubComponent(const ModelNode &componentNode)
@@ -354,6 +346,8 @@ void DesignDocument::changeToSubComponent(const ModelNode &componentNode)
activateCurrentModel(m_inFileComponentTextModifier.data());
}
if (!componentNode.id().isEmpty())
QmlDesignerPlugin::instance()->viewManager().pushInFileComponentOnCrambleBar(componentNode.id());
}
void DesignDocument::changeToExternalSubComponent(const QString &fileName)