Commit 13df303b authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.formEditor: crashfix

Avoid recursion if item is not movable.

Reviewed-by: Kai Koehne
Task-Nr: http://bugreports.qt.nokia.com/browse/QTCREATORBUG-4284
parent 35743ea1
......@@ -285,13 +285,13 @@ AbstractFormEditorTool* FormEditorView::currentTool() const
return m_currentTool;
}
void FormEditorView::changeToMoveTool()
bool FormEditorView::changeToMoveTool()
{
if (m_currentTool == m_moveTool)
return;
return true;
if (!isMoveToolAvailable())
return;
return false;
scene()->setPaintMode(FormEditorScene::NormalMode);
m_scene->updateAllFormEditorItems();
......@@ -300,6 +300,7 @@ void FormEditorView::changeToMoveTool()
m_currentTool = m_moveTool;
m_currentTool->clear();
m_currentTool->setItems(scene()->itemsForQmlItemNodes(selectedQmlItemNodes()));
return true;
}
void FormEditorView::changeToDragTool()
......@@ -317,13 +318,13 @@ void FormEditorView::changeToDragTool()
}
void FormEditorView::changeToMoveTool(const QPointF &beginPoint)
bool FormEditorView::changeToMoveTool(const QPointF &beginPoint)
{
if (m_currentTool == m_moveTool)
return;
return true;
if (!isMoveToolAvailable())
return;
return false;
scene()->setPaintMode(FormEditorScene::NormalMode);
m_scene->updateAllFormEditorItems();
......@@ -333,6 +334,7 @@ void FormEditorView::changeToMoveTool(const QPointF &beginPoint)
m_currentTool->clear();
m_currentTool->setItems(scene()->itemsForQmlItemNodes(selectedQmlItemNodes()));
m_moveTool->beginWithPoint(beginPoint);
return true;
}
void FormEditorView::changeToSelectionTool()
......
......@@ -91,8 +91,8 @@ public:
AbstractFormEditorTool *currentTool() const;
FormEditorScene *scene() const;
void changeToMoveTool();
void changeToMoveTool(const QPointF &beginPoint);
bool changeToMoveTool();
bool changeToMoveTool(const QPointF &beginPoint);
void changeToDragTool();
void changeToSelectionTool();
void changeToItemCreatorTool();
......
......@@ -210,8 +210,8 @@ void SelectionTool::keyPressEvent(QKeyEvent *event)
case Qt::Key_Right:
case Qt::Key_Up:
case Qt::Key_Down:
view()->changeToMoveTool();
view()->currentTool()->keyPressEvent(event);
if (view()->changeToMoveTool())
view()->currentTool()->keyPressEvent(event);
break;
}
}
......
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