QmlDesigner: Refactor currentModel() getters in QmlDesignerPlugin

Change-Id: I6d5085b591439cc2e79ca0f9872a1c0497c5f220
Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
This commit is contained in:
Marco Bubke
2014-06-30 14:58:11 +02:00
parent b49ba79973
commit c82eafd13f
2 changed files with 8 additions and 2 deletions

View File

@@ -225,7 +225,7 @@ void QmlDesignerPlugin::showDesigner()
void QmlDesignerPlugin::hideDesigner() void QmlDesignerPlugin::hideDesigner()
{ {
if (currentDesignDocument() if (currentDesignDocument()
&& currentDesignDocument()->currentModel() && currentModel()
&& !currentDesignDocument()->hasQmlSyntaxErrors()) && !currentDesignDocument()->hasQmlSyntaxErrors())
jumpTextCursorToSelectedModelNode(); jumpTextCursorToSelectedModelNode();
@@ -343,7 +343,7 @@ void QmlDesignerPlugin::deactivateAutoSynchronization()
void QmlDesignerPlugin::resetModelSelection() void QmlDesignerPlugin::resetModelSelection()
{ {
if (rewriterView() && currentDesignDocument()->currentModel()) if (rewriterView() && currentModel())
rewriterView()->setSelectedModelNodes(QList<ModelNode>()); rewriterView()->setSelectedModelNodes(QList<ModelNode>());
} }
@@ -352,6 +352,11 @@ RewriterView *QmlDesignerPlugin::rewriterView() const
return currentDesignDocument()->rewriterView(); return currentDesignDocument()->rewriterView();
} }
Model *QmlDesignerPlugin::currentModel() const
{
return currentDesignDocument()->currentModel();
}
static bool checkIfEditorIsQtQuick(Core::IEditor *editor) static bool checkIfEditorIsQtQuick(Core::IEditor *editor)
{ {
if (editor) if (editor)

View File

@@ -114,6 +114,7 @@ private: // functions
void deactivateAutoSynchronization(); void deactivateAutoSynchronization();
void resetModelSelection(); void resetModelSelection();
RewriterView *rewriterView() const; RewriterView *rewriterView() const;
Model *currentModel() const;
private: // variables private: // variables
QmlDesignerPluginData *data; QmlDesignerPluginData *data;