forked from qt-creator/qt-creator
QmlDesigner: Move flow effects to submenu
Change-Id: I2afdcc5068501b7b29543228668b543b0b68a4d1 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -41,6 +41,7 @@ const char anchorsCategory[] = "Anchors";
|
||||
const char positionCategory[] = "Position";
|
||||
const char layoutCategory[] = "Layout";
|
||||
const char flowCategory[] = "Flow";
|
||||
const char flowEffectCategory[] = "FlowEffect";
|
||||
const char flowConnectionCategory[] = "FlowConnection";
|
||||
const char stackedContainerCategory[] = "StackedContainer";
|
||||
const char genericToolBarCategory[] = "GenericToolBar";
|
||||
@@ -86,6 +87,7 @@ const char anchorsCategoryDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextM
|
||||
const char positionCategoryDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Position");
|
||||
const char layoutCategoryDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Layout");
|
||||
const char flowCategoryDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Flow");
|
||||
const char flowEffectCategoryDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Flow Effects");
|
||||
const char stackedContainerCategoryDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Stacked Container");
|
||||
|
||||
const char cutSelectionDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Cut");
|
||||
|
@@ -346,6 +346,12 @@ bool isFlowItem(const SelectionContext &context)
|
||||
&& QmlFlowItemNode::isValidQmlFlowItemNode(context.currentSingleSelectedNode());
|
||||
}
|
||||
|
||||
bool isFlowTarget(const SelectionContext &context)
|
||||
{
|
||||
return context.singleNodeIsSelected()
|
||||
&& QmlFlowTargetNode::isFlowEditorTarget(context.currentSingleSelectedNode());
|
||||
}
|
||||
|
||||
bool isFlowTransitionItem(const SelectionContext &context)
|
||||
{
|
||||
return context.singleNodeIsSelected()
|
||||
@@ -362,9 +368,9 @@ bool isFlowActionItemItem(const SelectionContext &context)
|
||||
|| QmlVisualNode::isFlowWildcard(selectedNode));
|
||||
}
|
||||
|
||||
bool isFlowItemOrTransition(const SelectionContext &context)
|
||||
bool isFlowTargetOrTransition(const SelectionContext &context)
|
||||
{
|
||||
return isFlowItem(context) || isFlowTransitionItem(context);
|
||||
return isFlowTarget(context) || isFlowTransitionItem(context);
|
||||
}
|
||||
|
||||
class FlowActionConnectAction : public ActionGroup
|
||||
@@ -853,15 +859,24 @@ void DesignerActionManager::createDefaultDesignerActions()
|
||||
priorityLayoutCategory,
|
||||
&layoutOptionVisible));
|
||||
|
||||
//isFlowTransitionItem
|
||||
|
||||
addDesignerAction(new ActionGroup(
|
||||
flowCategoryDisplayName,
|
||||
flowCategory,
|
||||
priorityFlowCategory,
|
||||
&isFlowItemOrTransition,
|
||||
&isFlowTargetOrTransition,
|
||||
&flowOptionVisible));
|
||||
|
||||
|
||||
auto effectMenu = new ActionGroup(
|
||||
flowEffectCategoryDisplayName,
|
||||
flowEffectCategory,
|
||||
priorityFlowCategory,
|
||||
&isFlowTransitionItem,
|
||||
&flowOptionVisible);
|
||||
|
||||
effectMenu->setCategory(flowCategory);
|
||||
addDesignerAction(effectMenu);
|
||||
|
||||
addDesignerAction(new ModelNodeFormEditorAction(
|
||||
createFlowActionAreaCommandId,
|
||||
createFlowActionAreaDisplayName,
|
||||
@@ -1186,7 +1201,7 @@ void DesignerActionManager::addTransitionEffectAction(const TypeName &typeName)
|
||||
QByteArray(ComponentCoreConstants::flowAssignEffectCommandId) + typeName,
|
||||
QLatin1String(ComponentCoreConstants::flowAssignEffectDisplayName) + typeName,
|
||||
{},
|
||||
ComponentCoreConstants::flowCategory,
|
||||
ComponentCoreConstants::flowEffectCategory,
|
||||
{},
|
||||
typeName == "None" ? 100 : 140,
|
||||
[typeName](const SelectionContext &context)
|
||||
|
@@ -132,16 +132,22 @@ public:
|
||||
|
||||
bool isVisible(const SelectionContext &m_selectionState) const override { return m_visibility(m_selectionState); }
|
||||
bool isEnabled(const SelectionContext &m_selectionState) const override { return m_enabled(m_selectionState); }
|
||||
QByteArray category() const override { return QByteArray(); }
|
||||
QByteArray category() const override { return m_category; }
|
||||
QByteArray menuId() const override { return m_menuId; }
|
||||
int priority() const override { return m_priority; }
|
||||
Type type() const override { return ContextMenu; }
|
||||
|
||||
void setCategory(const QByteArray &catageoryId)
|
||||
{
|
||||
m_category = catageoryId;
|
||||
}
|
||||
|
||||
private:
|
||||
const QByteArray m_menuId;
|
||||
const int m_priority;
|
||||
SelectionContextPredicate m_enabled;
|
||||
SelectionContextPredicate m_visibility;
|
||||
QByteArray m_category;
|
||||
};
|
||||
|
||||
class SeperatorDesignerAction : public AbstractAction
|
||||
|
Reference in New Issue
Block a user