From b108f72bc71a29c55470a749c622cad618831356 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 5 Aug 2013 16:07:31 +0200 Subject: [PATCH] QmlDesigner: remove DesignDocument::goIntoSelectedComponent() This function is highly confusing as a member of DesignDocument and the logic can be implemented directly in the ShortcutManager. Change-Id: Id722dcb71b542b4780614c9f895f06150ccb67ca Reviewed-by: Marco Bubke --- .../components/integration/designdocument.cpp | 15 --------------- .../components/integration/designdocument.h | 2 -- src/plugins/qmldesigner/shortcutmanager.cpp | 8 ++++++-- 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp index ead7112958f..bd169af5b24 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp @@ -311,21 +311,6 @@ void DesignDocument::changeToExternalSubComponent(const QString &fileName) Core::EditorManager::openEditor(fileName, Core::Id(), Core::EditorManager::DoNotMakeVisible); } -void DesignDocument::goIntoSelectedComponent() -{ - if (currentModel()) - return; - - QList selectedNodes; - if (rewriterView()) - selectedNodes = view()->selectedModelNodes(); - - if (selectedNodes.count() == 1) { - viewManager().setComponentNode(selectedNodes.first()); - DocumentManager::goIntoComponent(selectedNodes.first()); - } -} - void DesignDocument::attachRewriterToModel() { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); diff --git a/src/plugins/qmldesigner/components/integration/designdocument.h b/src/plugins/qmldesigner/components/integration/designdocument.h index 2e1b86d4a1e..234aeb15bbe 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.h +++ b/src/plugins/qmldesigner/components/integration/designdocument.h @@ -97,8 +97,6 @@ public: void resetToDocumentModel(); - void goIntoSelectedComponent(); - void changeToDocumentModel(); signals: diff --git a/src/plugins/qmldesigner/shortcutmanager.cpp b/src/plugins/qmldesigner/shortcutmanager.cpp index 9d5650f43b0..7da83aff622 100644 --- a/src/plugins/qmldesigner/shortcutmanager.cpp +++ b/src/plugins/qmldesigner/shortcutmanager.cpp @@ -304,8 +304,12 @@ void ShortCutManager::redoAvailable(bool isAvailable) void ShortCutManager::goIntoComponent() { - if (currentDesignDocument()) - currentDesignDocument()->goIntoSelectedComponent(); + if (currentDesignDocument() + && currentDesignDocument()->currentModel() + && currentDesignDocument()->rewriterView() + && currentDesignDocument()->rewriterView()->hasSingleSelectedModelNode()) { + DocumentManager::goIntoComponent(currentDesignDocument()->rewriterView()->singleSelectedModelNode()); + } } } // namespace QmlDesigner