Commit d5ce90af authored by Marco Bubke's avatar Marco Bubke
Browse files

QmlDesigner: Ask the view instead of cache values



Change-Id: I58b53af49f8f5570111c5cdb8a880e683c4ec51d
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent 786bd921
......@@ -33,7 +33,6 @@ namespace QmlDesigner {
SelectionContext::SelectionContext() :
m_isInBaseState(false),
m_toggled(false)
{
......@@ -41,11 +40,8 @@ SelectionContext::SelectionContext() :
SelectionContext::SelectionContext(QmlModelView *qmlModelView) :
m_qmlModelView(qmlModelView),
m_isInBaseState(qmlModelView->currentState().isBaseState()),
m_toggled(false)
{
if (qmlModelView && qmlModelView->model())
m_selectedModelNodes = qmlModelView->selectedModelNodes();
}
void SelectionContext::setTargetNode(const ModelNode &modelNode)
......@@ -60,25 +56,22 @@ ModelNode SelectionContext::targetNode() const
bool SelectionContext::singleNodeIsSelected() const
{
return m_selectedModelNodes.count() == 1;
return qmlModelView()->hasSingleSelectedModelNode();
}
bool SelectionContext::isInBaseState() const
{
return m_isInBaseState;
return qmlModelView()->currentState().isBaseState();
}
ModelNode SelectionContext::currentSingleSelectedNode() const
{
if (m_selectedModelNodes.count() != 1)
return ModelNode();
return m_selectedModelNodes.first();
return qmlModelView()->singleSelectedModelNode();
}
QList<ModelNode> SelectionContext::selectedModelNodes() const
{
return m_selectedModelNodes;
return qmlModelView()->selectedModelNodes();
}
QmlModelView *SelectionContext::qmlModelView() const
......
......@@ -66,8 +66,6 @@ public:
private:
QWeakPointer<QmlModelView> m_qmlModelView;
ModelNode m_targetNode;
bool m_isInBaseState;
QList<ModelNode> m_selectedModelNodes;
bool m_showSelectionTools;
QPoint m_scenePosition;
bool m_toggled;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment