Commit ff9e7a00 authored by Marco Bubke's avatar Marco Bubke

QmlDesigner: Remove qml function in the QmlModelView

Change-Id: I94748c9fad017038d61ff5a231a8e5f081985cc0
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent 6c848f1b
......@@ -84,7 +84,7 @@ bool AbstractFormEditorTool::topItemIsMovable(const QList<QGraphicsItem*> & item
return false;
FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(firstSelectableItem);
QList<QmlItemNode> selectedNodes = view()->selectedQmlItemNodes();
QList<ModelNode> selectedNodes = view()->selectedModelNodes();
if (formEditorItem != 0
&& selectedNodes.contains(formEditorItem->qmlItemNode()))
......@@ -96,7 +96,7 @@ bool AbstractFormEditorTool::topItemIsMovable(const QList<QGraphicsItem*> & item
bool AbstractFormEditorTool::topSelectedItemIsMovable(const QList<QGraphicsItem*> &itemList)
{
QList<QmlItemNode> selectedNodes = view()->selectedQmlItemNodes();
QList<ModelNode> selectedNodes = view()->selectedModelNodes();
foreach (QGraphicsItem *item, itemList) {
FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(item);
......
......@@ -285,7 +285,7 @@ void DragTool::dropEvent(QGraphicsSceneDragDropEvent * event)
if (m_dragNode.isValid()) {
QList<QmlItemNode> nodeList;
nodeList.append(m_dragNode);
view()->setSelectedQmlItemNodes(nodeList);
view()->setSelectedModelNodes(toModelNodeList(nodeList));
}
m_dragNode = ModelNode();
view()->changeToSelectionTool();
......@@ -345,7 +345,7 @@ void DragTool::dragLeaveEvent(QGraphicsSceneDragDropEvent * event)
QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::show();
QList<QmlItemNode> nodeList;
view()->setSelectedQmlItemNodes(nodeList);
view()->setSelectedModelNodes(toModelNodeList(nodeList));
view()->changeToSelectionTool();
}
}
......
......@@ -213,7 +213,7 @@ void FormEditorView::nodeAboutToBeRemoved(const ModelNode &removedNode)
if (newItemNode.isValid()) //only setup QmlItems
setupFormEditorItemTree(newItemNode);
m_currentTool->setItems(scene()->itemsForQmlItemNodes(selectedQmlItemNodes()));
m_currentTool->setItems(scene()->itemsForQmlItemNodes(toQmlItemNodeList(selectedModelNodes())));
}
void FormEditorView::propertiesAboutToBeRemoved(const QList<AbstractProperty>& propertyList)
......@@ -331,7 +331,7 @@ bool FormEditorView::changeToMoveTool()
m_currentTool->clear();
m_currentTool = m_moveTool;
m_currentTool->clear();
m_currentTool->setItems(scene()->itemsForQmlItemNodes(selectedQmlItemNodes()));
m_currentTool->setItems(scene()->itemsForQmlItemNodes(toQmlItemNodeList(selectedModelNodes())));
return true;
}
......@@ -344,7 +344,7 @@ void FormEditorView::changeToDragTool()
m_currentTool->clear();
m_currentTool = m_dragTool;
m_currentTool->clear();
m_currentTool->setItems(scene()->itemsForQmlItemNodes(selectedQmlItemNodes()));
m_currentTool->setItems(scene()->itemsForQmlItemNodes(toQmlItemNodeList(selectedModelNodes())));
}
......@@ -360,7 +360,7 @@ bool FormEditorView::changeToMoveTool(const QPointF &beginPoint)
m_currentTool->clear();
m_currentTool = m_moveTool;
m_currentTool->clear();
m_currentTool->setItems(scene()->itemsForQmlItemNodes(selectedQmlItemNodes()));
m_currentTool->setItems(scene()->itemsForQmlItemNodes(toQmlItemNodeList(selectedModelNodes())));
m_moveTool->beginWithPoint(beginPoint);
return true;
}
......@@ -374,7 +374,7 @@ void FormEditorView::changeToSelectionTool()
m_currentTool->clear();
m_currentTool = m_selectionTool;
m_currentTool->clear();
m_currentTool->setItems(scene()->itemsForQmlItemNodes(selectedQmlItemNodes()));
m_currentTool->setItems(scene()->itemsForQmlItemNodes(toQmlItemNodeList(selectedModelNodes())));
}
void FormEditorView::changeToSelectionTool(QGraphicsSceneMouseEvent *event)
......@@ -386,7 +386,7 @@ void FormEditorView::changeToSelectionTool(QGraphicsSceneMouseEvent *event)
m_currentTool->clear();
m_currentTool = m_selectionTool;
m_currentTool->clear();
m_currentTool->setItems(scene()->itemsForQmlItemNodes(selectedQmlItemNodes()));
m_currentTool->setItems(scene()->itemsForQmlItemNodes(toQmlItemNodeList(selectedModelNodes())));
m_selectionTool->selectUnderPoint(event);
}
......@@ -400,7 +400,7 @@ void FormEditorView::changeToResizeTool()
m_currentTool->clear();
m_currentTool = m_resizeTool;
m_currentTool->clear();
m_currentTool->setItems(scene()->itemsForQmlItemNodes(selectedQmlItemNodes()));
m_currentTool->setItems(scene()->itemsForQmlItemNodes(toQmlItemNodeList(selectedModelNodes())));
}
void FormEditorView::changeToTransformTools()
......@@ -434,7 +434,7 @@ void FormEditorView::changeToCustomTool()
m_currentTool->clear();
m_currentTool = selectedCustomTool;
m_currentTool->clear();
m_currentTool->setItems(scene()->itemsForQmlItemNodes(selectedQmlItemNodes()));
m_currentTool->setItems(scene()->itemsForQmlItemNodes(toQmlItemNodeList(selectedModelNodes())));
}
}
}
......@@ -445,7 +445,7 @@ void FormEditorView::changeToCustomTool(AbstractCustomTool *customTool)
m_currentTool->clear();
m_currentTool = customTool;
m_currentTool->clear();
m_currentTool->setItems(scene()->itemsForQmlItemNodes(selectedQmlItemNodes()));
m_currentTool->setItems(scene()->itemsForQmlItemNodes(toQmlItemNodeList(selectedModelNodes())));
}
void FormEditorView::registerTool(AbstractCustomTool *tool)
......@@ -627,9 +627,12 @@ void FormEditorView::setSelectOnlyContentItemsAction(bool selectOnlyContentItems
bool FormEditorView::isMoveToolAvailable() const
{
if (selectedQmlItemNodes().count() == 1)
return selectedQmlItemNodes().first().instanceIsMovable() &&
!selectedQmlItemNodes().first().instanceIsInLayoutable();
if (hasSingleSelectedModelNode() && QmlItemNode::isValidQmlItemNode(singleSelectedModelNode())) {
QmlItemNode selectedQmlItemNode(singleSelectedModelNode());
return selectedQmlItemNode.instanceIsMovable() &&
!selectedQmlItemNode.instanceIsInLayoutable();
}
return true;
}
......
......@@ -72,7 +72,7 @@ void RubberBandSelectionManipulator::begin(const QPointF& beginPoint)
m_selectionRectangleElement.show();
m_isActive = true;
m_beginFormEditorItem = topFormEditorItem(m_editorView->scene()->items(beginPoint));
m_oldSelectionList = m_editorView->selectedQmlItemNodes();
m_oldSelectionList = toQmlItemNodeList(m_editorView->selectedModelNodes());
}
void RubberBandSelectionManipulator::update(const QPointF& updatePoint)
......@@ -134,7 +134,7 @@ void RubberBandSelectionManipulator::select(SelectionType selectionType)
}
}
m_editorView->setSelectedQmlItemNodes(nodeList);
m_editorView->setSelectedModelNodes(toModelNodeList(nodeList));
}
......
......@@ -46,7 +46,7 @@ void SingleSelectionManipulator::begin(const QPointF &beginPoint)
{
m_beginPoint = beginPoint;
m_isActive = true;
m_oldSelectionList = m_editorView->selectedQmlItemNodes();
m_oldSelectionList = toQmlItemNodeList(m_editorView->selectedModelNodes());
}
void SingleSelectionManipulator::update(const QPointF &/*updatePoint*/)
......@@ -113,7 +113,7 @@ void SingleSelectionManipulator::select(SelectionType selectionType, bool select
}
}
m_editorView->setSelectedQmlItemNodes(nodeList);
m_editorView->setSelectedModelNodes(toModelNodeList(nodeList));
}
......
......@@ -61,19 +61,8 @@ public:
QmlItemNode createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, const QPointF &position, QmlItemNode parentNode);
QmlItemNode createQmlItemNodeFromImage(const QString &imageName, const QPointF &position, QmlItemNode parentNode);
QmlObjectNode rootQmlObjectNode() const;
QmlItemNode rootQmlItemNode() const;
void setSelectedQmlObjectNodes(const QList<QmlObjectNode> &selectedNodeList);
void setSelectedQmlItemNodes(const QList<QmlItemNode> &selectedNodeList);
void selectQmlObjectNode(const QmlObjectNode &node);
void deselectQmlObjectNode(const QmlObjectNode &node);
QList<QmlObjectNode> selectedQmlObjectNodes() const;
QList<QmlItemNode> selectedQmlItemNodes() const;
QmlObjectNode fxObjectNodeForId(const QString &id);
void modelAttached(Model *model) QTC_OVERRIDE;
void modelAboutToBeDetached(Model *model) QTC_OVERRIDE;
......
......@@ -400,9 +400,8 @@ QList<QmlItemNode> toQmlItemNodeList(const QList<ModelNode> &modelNodeList)
QList<QmlItemNode> qmlItemNodeList;
foreach (const ModelNode &modelNode, modelNodeList) {
QmlItemNode itemNode(modelNode);
if (itemNode.isValid())
qmlItemNodeList.append(itemNode);
if (QmlItemNode::isValidQmlItemNode(modelNode))
qmlItemNodeList.append(modelNode);
}
return qmlItemNodeList;
......
......@@ -270,49 +270,9 @@ QmlItemNode QmlModelView::createQmlItemNode(const ItemLibraryEntry &itemLibraryE
return newQmlItemNode;
}
QmlObjectNode QmlModelView::rootQmlObjectNode() const
{
return QmlObjectNode(rootModelNode());
}
QmlItemNode QmlModelView::rootQmlItemNode() const
{
return rootQmlObjectNode().toQmlItemNode();
}
void QmlModelView::setSelectedQmlObjectNodes(const QList<QmlObjectNode> &selectedNodeList)
{
setSelectedModelNodes(QmlDesigner::toModelNodeList(selectedNodeList));
}
void QmlModelView::selectQmlObjectNode(const QmlObjectNode &node)
{
selectModelNode(node.modelNode());
}
void QmlModelView::deselectQmlObjectNode(const QmlObjectNode &node)
{
deselectModelNode(node.modelNode());
}
QList<QmlObjectNode> QmlModelView::selectedQmlObjectNodes() const
{
return toQmlObjectNodeList(selectedModelNodes());
}
QList<QmlItemNode> QmlModelView::selectedQmlItemNodes() const
{
return toQmlItemNodeList(selectedModelNodes());
}
void QmlModelView::setSelectedQmlItemNodes(const QList<QmlItemNode> &selectedNodeList)
{
return setSelectedModelNodes(QmlDesigner::toModelNodeList(selectedNodeList));
}
QmlObjectNode QmlModelView::fxObjectNodeForId(const QString &id)
{
return QmlObjectNode(modelNodeForId(id));
return QmlItemNode(rootModelNode());
}
NodeInstance QmlModelView::instanceForModelNode(const ModelNode &modelNode)
......
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