Commit 68d32301 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.formEditor: allow selection of non movable items

Some items are not movable, but the user should still be able
to select them in the form editor.

Best example are items inside a positioner.
parent 386e2046
...@@ -290,6 +290,9 @@ void FormEditorView::changeToMoveTool() ...@@ -290,6 +290,9 @@ void FormEditorView::changeToMoveTool()
if (m_currentTool == m_moveTool) if (m_currentTool == m_moveTool)
return; return;
if (!isMoveToolAvailable())
return;
scene()->setPaintMode(FormEditorScene::NormalMode); scene()->setPaintMode(FormEditorScene::NormalMode);
m_scene->updateAllFormEditorItems(); m_scene->updateAllFormEditorItems();
setCursor(Qt::SizeAllCursor); setCursor(Qt::SizeAllCursor);
...@@ -319,6 +322,9 @@ void FormEditorView::changeToMoveTool(const QPointF &beginPoint) ...@@ -319,6 +322,9 @@ void FormEditorView::changeToMoveTool(const QPointF &beginPoint)
if (m_currentTool == m_moveTool) if (m_currentTool == m_moveTool)
return; return;
if (!isMoveToolAvailable())
return;
scene()->setPaintMode(FormEditorScene::NormalMode); scene()->setPaintMode(FormEditorScene::NormalMode);
m_scene->updateAllFormEditorItems(); m_scene->updateAllFormEditorItems();
setCursor(Qt::SizeAllCursor); setCursor(Qt::SizeAllCursor);
...@@ -600,6 +606,14 @@ void FormEditorView::setSelectOnlyContentItemsAction(bool selectOnlyContentItems ...@@ -600,6 +606,14 @@ void FormEditorView::setSelectOnlyContentItemsAction(bool selectOnlyContentItems
m_selectionTool->setSelectOnlyContentItems(selectOnlyContentItems); m_selectionTool->setSelectOnlyContentItems(selectOnlyContentItems);
} }
bool FormEditorView::isMoveToolAvailable() const
{
if (selectedQmlItemNodes().count() == 1)
return selectedQmlItemNodes().first().instanceIsMovable() &&
!selectedQmlItemNodes().first().instanceIsInPositioner();
return true;
}
void FormEditorView::stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState) void FormEditorView::stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState)
{ {
QmlModelView::stateChanged(newQmlModelState, oldQmlModelState); QmlModelView::stateChanged(newQmlModelState, oldQmlModelState);
......
...@@ -135,6 +135,7 @@ protected slots: ...@@ -135,6 +135,7 @@ protected slots:
QList<ModelNode> adjustStatesForModelNodes(const QList<ModelNode> &nodeList) const; QList<ModelNode> adjustStatesForModelNodes(const QList<ModelNode> &nodeList) const;
void updateGraphicsIndicators(); void updateGraphicsIndicators();
void setSelectOnlyContentItemsAction(bool selectOnlyContentItems); void setSelectOnlyContentItemsAction(bool selectOnlyContentItems);
bool isMoveToolAvailable() const;
private: //functions private: //functions
void setupFormEditorItemTree(const QmlItemNode &qmlItemNode); void setupFormEditorItemTree(const QmlItemNode &qmlItemNode);
......
...@@ -85,8 +85,6 @@ void SingleSelectionManipulator::select(SelectionType selectionType, bool select ...@@ -85,8 +85,6 @@ void SingleSelectionManipulator::select(SelectionType selectionType, bool select
if (formEditorItem if (formEditorItem
&& formEditorItem->qmlItemNode().isValid() && formEditorItem->qmlItemNode().isValid()
&& formEditorItem->qmlItemNode().instanceIsMovable()
&& !formEditorItem->qmlItemNode().instanceIsInPositioner()
&& (formEditorItem->qmlItemNode().hasShowContent() || !selectOnlyContentItems)) && (formEditorItem->qmlItemNode().hasShowContent() || !selectOnlyContentItems))
{ {
selectedNode = formEditorItem->qmlItemNode(); selectedNode = formEditorItem->qmlItemNode();
......
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