Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
......@@ -290,6 +290,9 @@ void FormEditorView::changeToMoveTool()
if (m_currentTool == m_moveTool)
return;
if (!isMoveToolAvailable())
return;
scene()->setPaintMode(FormEditorScene::NormalMode);
m_scene->updateAllFormEditorItems();
setCursor(Qt::SizeAllCursor);
......@@ -319,6 +322,9 @@ void FormEditorView::changeToMoveTool(const QPointF &beginPoint)
if (m_currentTool == m_moveTool)
return;
if (!isMoveToolAvailable())
return;
scene()->setPaintMode(FormEditorScene::NormalMode);
m_scene->updateAllFormEditorItems();
setCursor(Qt::SizeAllCursor);
......@@ -600,6 +606,14 @@ void FormEditorView::setSelectOnlyContentItemsAction(bool 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)
{
QmlModelView::stateChanged(newQmlModelState, oldQmlModelState);
......
......@@ -135,6 +135,7 @@ protected slots:
QList<ModelNode> adjustStatesForModelNodes(const QList<ModelNode> &nodeList) const;
void updateGraphicsIndicators();
void setSelectOnlyContentItemsAction(bool selectOnlyContentItems);
bool isMoveToolAvailable() const;
private: //functions
void setupFormEditorItemTree(const QmlItemNode &qmlItemNode);
......
......@@ -85,8 +85,6 @@ void SingleSelectionManipulator::select(SelectionType selectionType, bool select
if (formEditorItem
&& formEditorItem->qmlItemNode().isValid()
&& formEditorItem->qmlItemNode().instanceIsMovable()
&& !formEditorItem->qmlItemNode().instanceIsInPositioner()
&& (formEditorItem->qmlItemNode().hasShowContent() || !selectOnlyContentItems))
{
selectedNode = formEditorItem->qmlItemNode();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment