diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp index ee2264a84d4..bd1dec9fc21 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp @@ -120,28 +120,6 @@ Model *DesignDocument::documentModel() const return m_documentModel.data(); } -void DesignDocument::changeToDocumentModel() -{ - viewManager().detachRewriterView(); - viewManager().detachViewsExceptRewriterAndComponetView(); - - m_currentModel = m_documentModel.data(); - - viewManager().attachRewriterView(m_documentTextModifier.data()); - viewManager().attachViewsExceptRewriterAndComponetView(); -} - -void DesignDocument::changeToInFileComponentModel() -{ - viewManager().detachRewriterView(); - viewManager().detachViewsExceptRewriterAndComponetView(); - - m_currentModel = m_inFileComponentModel.data(); - - viewManager().attachRewriterView(m_inFileComponentTextModifier.data()); - viewManager().attachViewsExceptRewriterAndComponetView(); -} - QWidget *DesignDocument::centralWidget() const { return qobject_cast(parent()); @@ -306,13 +284,36 @@ void DesignDocument::loadDocument(QPlainTextEdit *edit) m_documentLoaded = true; } -void DesignDocument::changeCurrentModelTo(const ModelNode &node) +void DesignDocument::changeToDocumentModel() +{ + viewManager().detachRewriterView(); + viewManager().detachViewsExceptRewriterAndComponetView(); + + m_currentModel = m_documentModel.data(); + + viewManager().attachRewriterView(m_documentTextModifier.data()); + viewManager().attachViewsExceptRewriterAndComponetView(); +} + +void DesignDocument::changeToInFileComponentModel() +{ + viewManager().detachRewriterView(); + viewManager().detachViewsExceptRewriterAndComponetView(); + + m_currentModel = m_inFileComponentModel.data(); + + viewManager().attachRewriterView(m_inFileComponentTextModifier.data()); + viewManager().attachViewsExceptRewriterAndComponetView(); +} + +void DesignDocument::changeToSubComponentAndPushOnCrumblePath(const ModelNode &componentNode) { if (QmlDesignerPlugin::instance()->currentDesignDocument() != this) return; + changeToSubComponent(componentNode); - changeToSubComponent(node); + QmlDesignerPlugin::instance()->viewManager().pushInFileComponentOnCrambleBar(componentNode.id()); } void DesignDocument::changeToSubComponent(const ModelNode &componentNode) @@ -321,9 +322,8 @@ void DesignDocument::changeToSubComponent(const ModelNode &componentNode) QWeakPointer oldModel = m_currentModel; Q_ASSERT(oldModel.data()); - if (m_currentModel.data() == m_inFileComponentModel.data()) { + if (m_currentModel.data() == m_inFileComponentModel.data()) changeToDocumentModel(); - } bool subComponentLoaded = loadInFileComponent(componentNode); @@ -339,7 +339,7 @@ void DesignDocument::changeToExternalSubComponent(const QString &fileName) Core::EditorManager::openEditor(fileName); } -void DesignDocument::goIntoComponent() +void DesignDocument::goIntoSelectedComponent() { if (!m_currentModel) return; @@ -366,14 +366,6 @@ void DesignDocument::activateCurrentModel(TextModifier *textModifier) viewManager().attachRewriterView(textModifier); -// if (s_clearCrumblePath) -// m_formEditorView->crumblePath()->clear(); - -// if (s_pushCrumblePath && -// !differentCrumbleBarOnTop(m_formEditorView.data(), createCrumbleBarInfo().value())) -// m_formEditorView->crumblePath()->pushElement(simplfiedDisplayName(), createCrumbleBarInfo()); - - Q_ASSERT(m_documentModel); QApplication::restoreOverrideCursor(); } diff --git a/src/plugins/qmldesigner/components/integration/designdocument.h b/src/plugins/qmldesigner/components/integration/designdocument.h index 07378c3d139..9689c9872de 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.h +++ b/src/plugins/qmldesigner/components/integration/designdocument.h @@ -71,7 +71,6 @@ public: QString simplfiedDisplayName() const; void loadDocument(QPlainTextEdit *edit); - void activateCurrentModel(TextModifier *textModifier); void activateDocumentModel(); void close(); void updateSubcomponentManager(); @@ -99,7 +98,7 @@ public: void resetToDocumentModel(); - void goIntoComponent(); + void goIntoSelectedComponent(); void changeToDocumentModel(); @@ -121,8 +120,8 @@ public slots: void undo(); void redo(); void updateActiveQtVersion(); - void changeCurrentModelTo(const ModelNode &node); - void changeToSubComponent(const ModelNode &node); + void changeToSubComponentAndPushOnCrumblePath(const ModelNode &componentNode); + void changeToSubComponent(const ModelNode &componentNode); void changeToExternalSubComponent(const QString &m_oldFileName); private slots: @@ -130,6 +129,7 @@ private slots: private: // functions void changeToInFileComponentModel(); + void activateCurrentModel(TextModifier *textModifier); QWidget *centralWidget() const; QString pathToQt() const; diff --git a/src/plugins/qmldesigner/shortcutmanager.cpp b/src/plugins/qmldesigner/shortcutmanager.cpp index e53dee9f753..231b98e5ab5 100644 --- a/src/plugins/qmldesigner/shortcutmanager.cpp +++ b/src/plugins/qmldesigner/shortcutmanager.cpp @@ -318,7 +318,7 @@ void ShortCutManager::redoAvailable(bool isAvailable) void ShortCutManager::goIntoComponent() { if (currentDesignDocument()) - currentDesignDocument()->goIntoComponent(); + currentDesignDocument()->goIntoSelectedComponent(); } } // namespace QmlDesigner