forked from qt-creator/qt-creator
QmlDesigner: Add action for selecting effect
Change-Id: I7b89eb688fb7b9a9cd1ad21afcdf67c1662fd110 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -60,6 +60,7 @@ const char anchorsResetCommandId[] = "AnchorsReset";
|
||||
const char removePositionerCommandId[] = "RemovePositioner";
|
||||
const char createFlowActionAreaCommandId[] = "CreateFlowActionArea";
|
||||
const char setFlowStartCommandId[] = "SetFlowStart";
|
||||
const char selectFlowEffectCommandId[] = "SelectFlowEffect";
|
||||
const char layoutRowPositionerCommandId[] = "LayoutRowPositioner";
|
||||
const char layoutColumnPositionerCommandId[] = "LayoutColumnPositioner";
|
||||
const char layoutGridPositionerCommandId[] = "LayoutGridPositioner";
|
||||
@@ -83,6 +84,7 @@ const char addToGroupItemCommandId[] = "AddToGroupItem";
|
||||
|
||||
const char selectionCategoryDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Selection");
|
||||
const char flowConnectionCategoryDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Connect");
|
||||
const char selectEffectDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Select Effect");
|
||||
const char stackCategoryDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Stack (z)");
|
||||
const char editCategoryDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Edit");
|
||||
const char anchorsCategoryDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Anchors");
|
||||
|
@@ -358,6 +358,16 @@ bool isFlowTransitionItem(const SelectionContext &context)
|
||||
&& QmlFlowItemNode::isFlowTransition(context.currentSingleSelectedNode());
|
||||
}
|
||||
|
||||
bool isFlowTransitionItemWithEffect(const SelectionContext &context)
|
||||
{
|
||||
if (!isFlowTransitionItem(context))
|
||||
return false;
|
||||
|
||||
ModelNode node = context.currentSingleSelectedNode();
|
||||
|
||||
return node.hasNodeProperty("effect");
|
||||
}
|
||||
|
||||
bool isFlowActionItemItem(const SelectionContext &context)
|
||||
{
|
||||
const ModelNode selectedNode = context.currentSingleSelectedNode();
|
||||
@@ -933,6 +943,16 @@ void DesignerActionManager::createDefaultDesignerActions()
|
||||
for (const TypeName &typeName : types)
|
||||
addTransitionEffectAction(typeName);
|
||||
|
||||
addDesignerAction(new ModelNodeContextMenuAction(
|
||||
selectFlowEffectCommandId,
|
||||
selectEffectDisplayName,
|
||||
{},
|
||||
flowCategory,
|
||||
{},
|
||||
priorityFlowCategory,
|
||||
&selectFlowEffect,
|
||||
&isFlowTransitionItemWithEffect));
|
||||
|
||||
addDesignerAction(new ActionGroup(
|
||||
stackedContainerCategoryDisplayName,
|
||||
stackedContainerCategory,
|
||||
|
@@ -1201,6 +1201,22 @@ void addToGroupItem(const SelectionContext &selectionContext)
|
||||
}
|
||||
}
|
||||
|
||||
void selectFlowEffect(const SelectionContext &selectionContext)
|
||||
{
|
||||
if (!selectionContext.singleNodeIsSelected())
|
||||
return;
|
||||
|
||||
ModelNode node = selectionContext.currentSingleSelectedNode();
|
||||
QmlVisualNode transition(node);
|
||||
|
||||
QTC_ASSERT(transition.isValid(), return);
|
||||
QTC_ASSERT(transition.isFlowTransition(), return);
|
||||
|
||||
if (node.hasNodeProperty("effect")) {
|
||||
selectionContext.view()->setSelectedModelNode(node.nodeProperty("effect").modelNode());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Mode
|
||||
|
||||
} //QmlDesigner
|
||||
|
@@ -79,6 +79,7 @@ void addTransition(const SelectionContext &selectionState);
|
||||
void addFlowEffect(const SelectionContext &selectionState, const TypeName &typeName);
|
||||
void setFlowStartItem(const SelectionContext &selectionContext);
|
||||
void addToGroupItem(const SelectionContext &selectionContext);
|
||||
void selectFlowEffect(const SelectionContext &selectionContext);
|
||||
|
||||
} // namespace ModelNodeOperationso
|
||||
} //QmlDesigner
|
||||
|
Reference in New Issue
Block a user