forked from qt-creator/qt-creator
QmlDesigner: Add action for setting initial FlowItem
Change-Id: I23170f08b45a9560c3d6cae6f6d56396de9aab8b Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -57,6 +57,7 @@ const char anchorsFillCommandId[] = "AnchorsFill";
|
|||||||
const char anchorsResetCommandId[] = "AnchorsReset";
|
const char anchorsResetCommandId[] = "AnchorsReset";
|
||||||
const char removePositionerCommandId[] = "RemovePositioner";
|
const char removePositionerCommandId[] = "RemovePositioner";
|
||||||
const char createFlowActionAreaCommandId[] = "CreateFlowActionArea";
|
const char createFlowActionAreaCommandId[] = "CreateFlowActionArea";
|
||||||
|
const char setFlowStartCommandId[] = "SetFlowStart";
|
||||||
const char layoutRowPositionerCommandId[] = "LayoutRowPositioner";
|
const char layoutRowPositionerCommandId[] = "LayoutRowPositioner";
|
||||||
const char layoutColumnPositionerCommandId[] = "LayoutColumnPositioner";
|
const char layoutColumnPositionerCommandId[] = "LayoutColumnPositioner";
|
||||||
const char layoutGridPositionerCommandId[] = "LayoutGridPositioner";
|
const char layoutGridPositionerCommandId[] = "LayoutGridPositioner";
|
||||||
@@ -124,6 +125,7 @@ const char layoutGridPositionerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerCon
|
|||||||
const char layoutFlowPositionerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Position in Flow");
|
const char layoutFlowPositionerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Position in Flow");
|
||||||
const char removePositionerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Remove Positioner");
|
const char removePositionerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Remove Positioner");
|
||||||
const char createFlowActionAreaDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Create Flow Action");
|
const char createFlowActionAreaDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Create Flow Action");
|
||||||
|
const char setFlowStartDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Set Flow Start");
|
||||||
const char removeLayoutDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Remove Layout");
|
const char removeLayoutDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Remove Layout");
|
||||||
|
|
||||||
const char addItemToStackedContainerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Add Item");
|
const char addItemToStackedContainerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Add Item");
|
||||||
|
@@ -874,6 +874,17 @@ void DesignerActionManager::createDefaultDesignerActions()
|
|||||||
&isFlowItem,
|
&isFlowItem,
|
||||||
&flowOptionVisible));
|
&flowOptionVisible));
|
||||||
|
|
||||||
|
addDesignerAction(new ModelNodeContextMenuAction(
|
||||||
|
setFlowStartCommandId,
|
||||||
|
setFlowStartDisplayName,
|
||||||
|
{},
|
||||||
|
flowCategory,
|
||||||
|
priorityFirst,
|
||||||
|
{},
|
||||||
|
&setFlowStartItem,
|
||||||
|
&isFlowItem,
|
||||||
|
&flowOptionVisible));
|
||||||
|
|
||||||
addDesignerAction(new FlowActionConnectAction(
|
addDesignerAction(new FlowActionConnectAction(
|
||||||
flowConnectionCategoryDisplayName,
|
flowConnectionCategoryDisplayName,
|
||||||
flowConnectionCategory,
|
flowConnectionCategory,
|
||||||
|
@@ -1100,7 +1100,24 @@ void addFlowEffect(const SelectionContext &selectionContext, const TypeName &typ
|
|||||||
container.nodeProperty("effect").reparentHere(effectNode);
|
container.nodeProperty("effect").reparentHere(effectNode);
|
||||||
view->setSelectedModelNode(effectNode);
|
view->setSelectedModelNode(effectNode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFlowStartItem(const SelectionContext &selectionContext)
|
||||||
|
{
|
||||||
|
AbstractView *view = selectionContext.view();
|
||||||
|
|
||||||
|
QTC_ASSERT(view && selectionContext.hasSingleSelectedModelNode(), return);
|
||||||
|
ModelNode node = selectionContext.currentSingleSelectedNode();
|
||||||
|
QTC_ASSERT(node.isValid(), return);
|
||||||
|
QTC_ASSERT(node.metaInfo().isValid(), return);
|
||||||
|
QmlFlowItemNode flowItem(node);
|
||||||
|
QTC_ASSERT(flowItem.isValid(), return);
|
||||||
|
QTC_ASSERT(flowItem.flowView().isValid(), return);
|
||||||
|
view->executeInTransaction("DesignerActionManager:setFlowStartItem",
|
||||||
|
[&flowItem](){
|
||||||
|
flowItem.flowView().setStartFlowItem(flowItem);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Mode
|
} // namespace Mode
|
||||||
|
@@ -77,6 +77,7 @@ bool addFontToProject(const QStringList &fileNames, const QString &directory);
|
|||||||
void createFlowActionArea(const SelectionContext &selectionContext);
|
void createFlowActionArea(const SelectionContext &selectionContext);
|
||||||
void addTransition(const SelectionContext &selectionState);
|
void addTransition(const SelectionContext &selectionState);
|
||||||
void addFlowEffect(const SelectionContext &selectionState, const TypeName &typeName);
|
void addFlowEffect(const SelectionContext &selectionState, const TypeName &typeName);
|
||||||
|
void setFlowStartItem(const SelectionContext &selectionContext);
|
||||||
|
|
||||||
} // namespace ModelNodeOperationso
|
} // namespace ModelNodeOperationso
|
||||||
} //QmlDesigner
|
} //QmlDesigner
|
||||||
|
Reference in New Issue
Block a user