forked from qt-creator/qt-creator
QmlDesigner: Refactor currentModel() getters in QmlDesignerPlugin
Change-Id: I6d5085b591439cc2e79ca0f9872a1c0497c5f220 Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
This commit is contained in:
@@ -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)
|
||||||
|
@@ -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;
|
||||||
|
Reference in New Issue
Block a user