QmlDesigner: Implement new context menu structure

The 2D Context Menu is rearranged

Task-number: QDS-8388
Change-Id: Idca46da89a876f2a9a90acb9072be896d3e74468
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Ali Kianian
2022-12-01 13:17:49 +02:00
parent 430998d769
commit ef8802487e
18 changed files with 231 additions and 320 deletions

View File

@@ -27,53 +27,8 @@
namespace QmlDesigner {
class ColorToolAction : public AbstractAction
{
public:
ColorToolAction() : AbstractAction(QCoreApplication::translate("ColorToolAction","Edit Color")) {}
QByteArray category() const override
{
return QByteArray();
}
QByteArray menuId() const override
{
return "ColorTool";
}
int priority() const override
{
return CustomActionsPriority;
}
Type type() const override
{
return FormEditorAction;
}
protected:
bool isVisible(const SelectionContext &selectionContext) const override
{
if (selectionContext.singleNodeIsSelected())
return selectionContext.currentSingleSelectedNode().metaInfo().hasProperty("color");
return false;
}
bool isEnabled(const SelectionContext &selectionContext) const override
{
return isVisible(selectionContext);
}
};
ColorTool::ColorTool()
{
auto colorToolAction = new ColorToolAction;
QmlDesignerPlugin::instance()->designerActionManager().addDesignerAction(colorToolAction);
connect(colorToolAction->action(), &QAction::triggered, [=]() {
view()->changeCurrentToolTo(this);
});
}
ColorTool::~ColorTool() = default;

View File

@@ -25,10 +25,10 @@ public:
};
enum Priorities {
HighestPriority = ComponentCoreConstants::priorityFirst,
CustomActionsPriority = ComponentCoreConstants::priorityCustomActions,
RefactoringActionsPriority = ComponentCoreConstants::priorityRefactoring,
LowestPriority = ComponentCoreConstants::priorityLast
HighestPriority = ComponentCoreConstants::Priorities::Top,
CustomActionsPriority = ComponentCoreConstants::Priorities::CustomActionsSection,
RefactoringActionsPriority = ComponentCoreConstants::Priorities::Refactoring,
LowestPriority = ComponentCoreConstants::Priorities::Last
};
enum class TargetView {

View File

@@ -17,7 +17,7 @@ const char arrangeCategory[] = "Arrange";
const char qmlPreviewCategory[] = "QmlPreview";
const char editCategory[] = "Edit";
const char anchorsCategory[] = "Anchors";
const char positionCategory[] = "Position";
const char positionerCategory[] = "Position";
const char groupCategory[] = "Group";
const char snappingCategory[] = "Snapping";
const char layoutCategory[] = "Layout";
@@ -59,7 +59,7 @@ const char goIntoComponentCommandId[] = "GoIntoComponent";
const char mergeTemplateCommandId[] = "MergeTemplate";
const char goToImplementationCommandId[] = "GoToImplementation";
const char addSignalHandlerCommandId[] = "AddSignalHandler";
const char moveToComponentCommandId[] = "MoveToComponent";
const char makeComponentCommandId[] = "MakeComponent";
const char editMaterialCommandId[] = "EditMaterial";
const char addItemToStackedContainerCommandId[] = "AddItemToStackedContainer";
const char addTabBarToStackedContainerCommandId[] = "AddTabBarToStackedContainer";
@@ -71,7 +71,7 @@ const char addToGroupItemCommandId[] = "AddToGroupItem";
const char removeGroupItemCommandId[] = "RemoveToGroupItem";
const char fitRootToScreenCommandId[] = "FitRootToScreen";
const char fitSelectionToScreenCommandId[] = "FitSelectionToScreen";
const char editAnnotationCommandId[] = "EditAnnotation";
const char editAnnotationsCommandId[] = "EditAnnotation";
const char addMouseAreaFillCommandId[] = "AddMouseAreaFill";
const char openSignalDialogCommandId[] = "OpenSignalDialog";
@@ -84,8 +84,9 @@ const char selectEffectDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu
const char arrangeCategoryDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Arrange");
const char editCategoryDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Edit");
const char anchorsCategoryDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Anchors");
const char positionCategoryDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Position");
const char positionerCategoryDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Positioner");
const char groupCategoryDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Group");
const char snappingCategoryDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Snapping");
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");
@@ -112,13 +113,13 @@ const char resetPositionDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMen
const char copyFormatDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Copy Formatting");
const char applyFormatDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Apply Formatting");
const char goIntoComponentDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Go into Component");
const char mergeTemplateDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Merge File With Template");
const char enterComponentDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Enter Component");
const char mergeTemplateDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Merge with Template");
const char goToImplementationDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Go to Implementation");
const char addSignalHandlerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Add New Signal Handler");
const char moveToComponentDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Move Component into Separate File");
const char makeComponentDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Make Component");
const char editMaterialDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Edit Material");
const char editAnnotationDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Edit Annotation");
const char editAnnotationsDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Edit Annotations");
const char addMouseAreaFillDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Add Mouse Area");
const char openSignalDialogDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Open Signal Dialog");
@@ -130,13 +131,13 @@ const char resetZDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Re
const char reverseDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Reverse");
const char anchorsFillDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Fill");
const char anchorsResetDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Reset");
const char anchorsFillDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Fill Parent");
const char anchorsResetDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "No Anchors");
const char layoutColumnPositionerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Position in Column");
const char layoutRowPositionerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Position in Row");
const char layoutGridPositionerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Position in Grid");
const char layoutFlowPositionerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Position in Flow");
const char layoutColumnPositionerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Column Positioner");
const char layoutRowPositionerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Row Positioner");
const char layoutGridPositionerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Grid Positioner");
const char layoutFlowPositionerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Flow Positioner");
const char removePositionerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Remove Positioner");
const char createFlowActionAreaDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Create Flow Action");
const char setFlowStartDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Set Flow Start");
@@ -151,9 +152,9 @@ const char addTabBarToStackedContainerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesi
const char increaseIndexToStackedContainerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Increase Index");
const char decreaseIndexToStackedContainerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Decrease Index");
const char layoutColumnLayoutDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Layout in Column Layout");
const char layoutRowLayoutDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Layout in Row Layout");
const char layoutGridLayoutDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Layout in Grid Layout");
const char layoutColumnLayoutDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Column Layout");
const char layoutRowLayoutDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Row Layout");
const char layoutGridLayoutDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Grid Layout");
const char layoutFillWidthDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Fill Width");
const char layoutFillHeightDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Fill Height");
@@ -183,26 +184,48 @@ const char addFlowActionToolTip[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu",
const char editListModelDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu",
"Edit List Model...");
const int priorityFirst = 280;
const int prioritySelectionCategory = 220;
const int priorityConnectionsCategory = 210;
const int priorityQmlPreviewCategory = 200;
const int priorityStackCategory = 180;
const int priorityEditCategory = 160;
const int priorityAnchorsCategory = 140;
const int priorityFlowCategory = 240;
const int priorityGroupCategory = 140;
const int priorityPositionCategory = 130;
const int priorityLayoutCategory = 120;
const int priorityStackedContainerCategory = priorityLayoutCategory;
const int priorityEventListCategory = 105;
const int priorityTopLevelSeperator = 100;
const int priorityCustomActions = 80;
const int priorityRefactoring = 60;
const int priorityGoIntoComponent = 40;
const int priorityGenericToolBar = 50;
const int priorityLast = 60;
namespace Priorities {
enum PrioritiesEnum : int {
Top = 0,
FlowCategory,
ComponentActions,
/******** Section *****************************/
ModifySection = 1000,
ConnectionsCategory,
SelectionCategory,
ArrangeCategory,
EditCategory,
/******** Section *****************************/
PositionSection = 2000,
SnappingCategory,
AnchorsCategory,
LayoutCategory,
PositionCategory,
StackedContainerCategory,
/******** Section *****************************/
EventSection = 3000,
TimelineCategory,
EventListCategory,
/******** Section *****************************/
AdditionsSection = 4000,
EditAnnotations,
AddMouseArea,
MergeWithTemplate,
/******** Section *****************************/
ViewOprionsSection = 5000,
ResetView,
Group,
Visibility,
ShowBoundingRect,
/******** Section *****************************/
CustomActionsSection = 6000,
QmlPreviewCategory,
SignalsDialog,
Refactoring,
GenericToolBar,
Last
};
};
const char addImagesDisplayString[] = QT_TRANSLATE_NOOP("QmlDesignerAddResources", "Image Files");
const char addFontsDisplayString[] = QT_TRANSLATE_NOOP("QmlDesignerAddResources", "Font Files");

View File

@@ -73,7 +73,7 @@ DesignerActionToolBar *DesignerActionManager::createToolBar(QWidget *parent) con
});
Utils::sort(categories, [](ActionInterface *l, ActionInterface *r) {
return l->priority() > r->priority();
return l->priority() < r->priority();
});
for (auto *categoryAction : std::as_const(categories)) {
@@ -82,7 +82,7 @@ DesignerActionToolBar *DesignerActionManager::createToolBar(QWidget *parent) con
});
Utils::sort(actions, [](ActionInterface *l, ActionInterface *r) {
return l->priority() > r->priority();
return l->priority() < r->priority();
});
bool addSeparator = false;
@@ -142,7 +142,7 @@ QGraphicsWidget *DesignerActionManager::createFormEditorToolBar(QGraphicsItem *p
});
Utils::sort(actions, [](ActionInterface *l, ActionInterface *r) {
return l->priority() > r->priority();
return l->priority() < r->priority();
});
QGraphicsWidget *toolbar = new QGraphicsWidget(parent);
@@ -401,8 +401,7 @@ public:
if (!ModelNode::isThisOrAncestorLocked(parentNode)) {
ActionTemplate *selectionAction = new ActionTemplate("SELECTION", {}, &ModelNodeOperations::select);
selectionAction->setParent(menu());
selectionAction->setText(QString(QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Select parent: %1")).arg(
captionForModelNode(parentNode)));
selectionAction->setText(QString(QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Parent")));
SelectionContext nodeSelectionContext = selectionContext();
nodeSelectionContext.setTargetNode(parentNode);
@@ -1341,26 +1340,28 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new SelectionModelNodeAction(
selectionCategoryDisplayName,
selectionCategory,
prioritySelectionCategory));
Priorities::SelectionCategory));
addDesignerAction(new ConnectionsModelNodeActionGroup(
connectionsCategoryDisplayName,
connectionsCategory,
priorityConnectionsCategory));
Priorities::ConnectionsCategory));
addDesignerAction(new ActionGroup(
arrangeCategoryDisplayName,
arrangeCategory,
priorityStackCategory,
Priorities::ArrangeCategory,
&selectionNotEmpty));
addDesignerAction(new SeperatorDesignerAction(arrangeCategory, 10));
addDesignerAction(new ModelNodeContextMenuAction(
toFrontCommandId,
toFrontDisplayName,
{},
arrangeCategory,
QKeySequence(),
200,
1,
&toFront,
&raiseAvailable));
@@ -1370,7 +1371,7 @@ void DesignerActionManager::createDefaultDesignerActions()
Utils::Icon({{":/qmldesigner/icon/designeractions/images/raise.png", Utils::Theme::IconsBaseColor}}).icon(),
arrangeCategory,
QKeySequence(),
180,
11,
&raise,
&raiseAvailable));
@@ -1380,7 +1381,7 @@ void DesignerActionManager::createDefaultDesignerActions()
Utils::Icon({{":/qmldesigner/icon/designeractions/images/lower.png", Utils::Theme::IconsBaseColor}}).icon(),
arrangeCategory,
QKeySequence(),
160,
12,
&lower,
&lowerAvailable));
@@ -1390,23 +1391,25 @@ void DesignerActionManager::createDefaultDesignerActions()
{},
arrangeCategory,
QKeySequence(),
140,
2,
&toBack,
&lowerAvailable));
addDesignerAction(new SeperatorDesignerAction(arrangeCategory, 20));
addDesignerAction(new ModelNodeContextMenuAction(
reverseCommandId,
reverseDisplayName,
{},
arrangeCategory,
QKeySequence(),
100,
21,
&reverse,
&multiSelectionAndHasSameParent));
addDesignerAction(new ActionGroup(editCategoryDisplayName, editCategory, priorityEditCategory, &selectionNotEmpty));
addDesignerAction(new ActionGroup(editCategoryDisplayName, editCategory, Priorities::EditCategory, &selectionNotEmpty));
addDesignerAction(new SeperatorDesignerAction(editCategory, 220));
addDesignerAction(new SeperatorDesignerAction(editCategory, 30));
addDesignerAction(
new ModelNodeAction(resetPositionCommandId,
@@ -1418,7 +1421,7 @@ void DesignerActionManager::createDefaultDesignerActions()
resetPositionTooltip,
editCategory,
QKeySequence("Ctrl+d"),
200,
32,
&resetPosition,
&selectionNotEmptyAndHasXorYProperty));
@@ -1456,7 +1459,7 @@ void DesignerActionManager::createDefaultDesignerActions()
copyFormatTooltip,
editCategory,
QKeySequence(),
120,
41,
&copyFormat,
&propertiesCopyable));
@@ -1466,7 +1469,7 @@ void DesignerActionManager::createDefaultDesignerActions()
applyFormatTooltip,
editCategory,
QKeySequence(),
120,
42,
&applyFormat,
&propertiesApplyable));
@@ -1478,24 +1481,24 @@ void DesignerActionManager::createDefaultDesignerActions()
resetSizeToolTip,
editCategory,
QKeySequence("shift+s"),
180,
31,
&resetSize,
&selectionNotEmptyAndHasWidthOrHeightProperty));
addDesignerAction(new SeperatorDesignerAction(editCategory, 170));
addDesignerAction(new SeperatorDesignerAction(editCategory, 40));
addDesignerAction(new VisiblityModelNodeAction(
visiblityCommandId,
visibilityDisplayName,
editCategory,
rootCategory,
QKeySequence("Ctrl+g"),
160,
Priorities::Visibility,
&setVisible,
&singleSelectedItem));
addDesignerAction(new ActionGroup(anchorsCategoryDisplayName,
anchorsCategory,
priorityAnchorsCategory,
Priorities::AnchorsCategory,
&anchorsMenuEnabled));
addDesignerAction(new ModelNodeAction(
@@ -1505,7 +1508,7 @@ void DesignerActionManager::createDefaultDesignerActions()
anchorsFillToolTip,
anchorsCategory,
QKeySequence(QKeySequence("shift+f")),
200,
2,
&anchorsFill,
&singleSelectionItemIsNotAnchoredAndSingleSelectionNotRoot));
@@ -1517,38 +1520,41 @@ void DesignerActionManager::createDefaultDesignerActions()
anchorsResetToolTip,
anchorsCategory,
QKeySequence(QKeySequence("Ctrl+Shift+r")),
180,
1,
&anchorsReset,
&singleSelectionItemIsAnchored));
addDesignerAction(new SeperatorDesignerAction(anchorsCategory, 170));
addDesignerAction(new SeperatorDesignerAction(anchorsCategory, 10));
addDesignerAction(new ActionGroup(
positionCategoryDisplayName,
positionCategory,
priorityPositionCategory,
positionerCategoryDisplayName,
positionerCategory,
Priorities::PositionCategory,
&positionOptionVisible));
addDesignerAction(new ActionGroup(layoutCategoryDisplayName,
addDesignerAction(new ActionGroup(
layoutCategoryDisplayName,
layoutCategory,
priorityLayoutCategory,
Priorities::LayoutCategory,
&layoutOptionVisible));
addDesignerAction(new ActionGroup("Snapping",
addDesignerAction(new ActionGroup(
snappingCategoryDisplayName,
snappingCategory,
priorityLayoutCategory + 10,
Priorities::SnappingCategory,
&selectionEnabled,
&selectionEnabled));
addDesignerAction(new ActionGroup(groupCategoryDisplayName,
addDesignerAction(new ActionGroup(
groupCategoryDisplayName,
groupCategory,
priorityGroupCategory,
Priorities::Group,
&studioComponentsAvailableAndSelectionCanBeLayouted));
addDesignerAction(new ActionGroup(
flowCategoryDisplayName,
flowCategory,
priorityFlowCategory,
Priorities::FlowCategory,
&isFlowTargetOrTransition,
&flowOptionVisible));
@@ -1556,7 +1562,7 @@ void DesignerActionManager::createDefaultDesignerActions()
auto effectMenu = new ActionGroup(
flowEffectCategoryDisplayName,
flowEffectCategory,
priorityFlowCategory,
Priorities::FlowCategory,
&isFlowTransitionItem,
&flowOptionVisible);
@@ -1570,7 +1576,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addFlowActionToolTip,
flowCategory,
{},
priorityFirst,
1,
&createFlowActionArea,
&isFlowItem,
&flowOptionVisible));
@@ -1580,7 +1586,7 @@ void DesignerActionManager::createDefaultDesignerActions()
setFlowStartDisplayName,
{},
flowCategory,
priorityFirst,
2,
{},
&setFlowStartItem,
&isFlowItem,
@@ -1589,7 +1595,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new FlowActionConnectAction(
flowConnectionCategoryDisplayName,
flowConnectionCategory,
priorityFlowCategory));
Priorities::FlowCategory));
const QList<TypeName> transitionTypes = {"FlowFadeEffect",
@@ -1608,23 +1614,23 @@ void DesignerActionManager::createDefaultDesignerActions()
{},
flowCategory,
{},
priorityFlowCategory,
2,
&selectFlowEffect,
&isFlowTransitionItemWithEffect));
addDesignerAction(new ActionGroup(
stackedContainerCategoryDisplayName,
stackedContainerCategory,
priorityStackedContainerCategory,
Priorities::StackedContainerCategory,
&isStackedContainer));
addDesignerAction(new ModelNodeContextMenuAction(
removePositionerCommandId,
removePositionerDisplayName,
{},
positionCategory,
positionerCategory,
QKeySequence("Ctrl+Shift+p"),
210,
1,
&removePositioner,
&isPositioner,
&isPositioner));
@@ -1633,9 +1639,9 @@ void DesignerActionManager::createDefaultDesignerActions()
layoutRowPositionerCommandId,
layoutRowPositionerDisplayName,
{},
positionCategory,
positionerCategory,
QKeySequence(),
200,
2,
&layoutRowPositioner,
&selectionCanBeLayouted,
&selectionCanBeLayouted));
@@ -1644,9 +1650,9 @@ void DesignerActionManager::createDefaultDesignerActions()
layoutColumnPositionerCommandId,
layoutColumnPositionerDisplayName,
{},
positionCategory,
positionerCategory,
QKeySequence(),
180,
3,
&layoutColumnPositioner,
&selectionCanBeLayouted,
&selectionCanBeLayouted));
@@ -1655,9 +1661,9 @@ void DesignerActionManager::createDefaultDesignerActions()
layoutGridPositionerCommandId,
layoutGridPositionerDisplayName,
{},
positionCategory,
positionerCategory,
QKeySequence(),
160,
4,
&layoutGridPositioner,
&selectionCanBeLayouted,
&selectionCanBeLayouted));
@@ -1666,14 +1672,14 @@ void DesignerActionManager::createDefaultDesignerActions()
layoutFlowPositionerCommandId,
layoutFlowPositionerDisplayName,
{},
positionCategory,
positionerCategory,
QKeySequence("Ctrl+m"),
140,
5,
&layoutFlowPositioner,
&selectionCanBeLayouted,
&selectionCanBeLayouted));
addDesignerAction(new SeperatorDesignerAction(layoutCategory, 120));
addDesignerAction(new SeperatorDesignerAction(layoutCategory, 0));
addDesignerAction(new ModelNodeContextMenuAction(
removeLayoutCommandId,
@@ -1681,7 +1687,7 @@ void DesignerActionManager::createDefaultDesignerActions()
{},
layoutCategory,
QKeySequence(),
110,
1,
&removeLayout,
&isLayout,
&isLayout));
@@ -1691,7 +1697,7 @@ void DesignerActionManager::createDefaultDesignerActions()
{},
groupCategory,
QKeySequence("Ctrl+Shift+g"),
110,
1,
&addToGroupItem,
&selectionCanBeLayouted));
@@ -1700,7 +1706,7 @@ void DesignerActionManager::createDefaultDesignerActions()
{},
groupCategory,
QKeySequence(),
110,
2,
&removeGroup,
&isGroup));
@@ -1710,7 +1716,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addItemToStackedContainerToolTip,
stackedContainerCategory,
QKeySequence("Ctrl+Shift+a"),
110,
1,
&addItemToStackedContainer,
&isStackedContainer,
&isStackedContainer));
@@ -1721,7 +1727,7 @@ void DesignerActionManager::createDefaultDesignerActions()
{},
stackedContainerCategory,
QKeySequence("Ctrl+Shift+t"),
100,
2,
&addTabBarToStackedContainer,
&isStackedContainerWithoutTabBar,
&isStackedContainer));
@@ -1733,7 +1739,7 @@ void DesignerActionManager::createDefaultDesignerActions()
decreaseIndexOfStackedContainerToolTip,
stackedContainerCategory,
QKeySequence("Ctrl+Shift+Left"),
80,
3,
&decreaseIndexOfStackedContainer,
&isStackedContainerAndIndexCanBeDecreased,
&isStackedContainer));
@@ -1745,7 +1751,7 @@ void DesignerActionManager::createDefaultDesignerActions()
increaseIndexOfStackedContainerToolTip,
stackedContainerCategory,
QKeySequence("Ctrl+Shift+Right"),
80,
4,
&increaseIndexOfStackedContainer,
&isStackedContainerAndIndexCanBeIncreased,
&isStackedContainer));
@@ -1757,7 +1763,7 @@ void DesignerActionManager::createDefaultDesignerActions()
layoutRowLayoutToolTip,
layoutCategory,
QKeySequence("Ctrl+u"),
100,
2,
&layoutRowLayout,
&selectionCanBeLayoutedAndQtQuickLayoutPossible));
@@ -1768,7 +1774,7 @@ void DesignerActionManager::createDefaultDesignerActions()
layoutColumnLayoutToolTip,
layoutCategory,
QKeySequence("Ctrl+l"),
80,
3,
&layoutColumnLayout,
&selectionCanBeLayoutedAndQtQuickLayoutPossible));
@@ -1779,18 +1785,18 @@ void DesignerActionManager::createDefaultDesignerActions()
layoutGridLayoutToolTip,
layoutCategory,
QKeySequence("shift+g"),
60,
4,
&layoutGridLayout,
&selectionCanBeLayoutedAndQtQuickLayoutPossibleAndNotMCU));
addDesignerAction(new SeperatorDesignerAction(layoutCategory, 50));
addDesignerAction(new SeperatorDesignerAction(layoutCategory, 10));
addDesignerAction(new FillWidthModelNodeAction(
layoutFillWidthCommandId,
layoutFillWidthDisplayName,
layoutCategory,
QKeySequence(),
40,
11,
&setFillWidth,
&singleSelectionAndInQtQuickLayout,
&singleSelectionAndInQtQuickLayout));
@@ -1800,30 +1806,35 @@ void DesignerActionManager::createDefaultDesignerActions()
layoutFillHeightDisplayName,
layoutCategory,
QKeySequence(),
20,
12,
&setFillHeight,
&singleSelectionAndInQtQuickLayout,
&singleSelectionAndInQtQuickLayout));
addDesignerAction(new SeperatorDesignerAction(rootCategory, priorityTopLevelSeperator));
addDesignerAction(new SeperatorDesignerAction(rootCategory, Priorities::ModifySection));
addDesignerAction(new SeperatorDesignerAction(rootCategory, Priorities::PositionSection));
addDesignerAction(new SeperatorDesignerAction(rootCategory, Priorities::EventSection));
addDesignerAction(new SeperatorDesignerAction(rootCategory, Priorities::AdditionsSection));
addDesignerAction(new SeperatorDesignerAction(rootCategory, Priorities::ViewOprionsSection));
addDesignerAction(new SeperatorDesignerAction(rootCategory, Priorities::CustomActionsSection));
addDesignerAction(new ModelNodeContextMenuAction(
goIntoComponentCommandId,
goIntoComponentDisplayName,
enterComponentDisplayName,
{},
rootCategory,
QKeySequence(Qt::Key_F2),
priorityGoIntoComponent,
Priorities::ComponentActions + 2,
&goIntoComponentOperation,
&selectionIsComponent));
addDesignerAction(new ModelNodeContextMenuAction(
editAnnotationCommandId,
editAnnotationDisplayName,
editAnnotationsCommandId,
editAnnotationsDisplayName,
{},
rootCategory,
QKeySequence(),
(priorityLast+6),
Priorities::EditAnnotations,
&editAnnotation,
&singleSelection,
&singleSelection));
@@ -1834,7 +1845,7 @@ void DesignerActionManager::createDefaultDesignerActions()
{},
rootCategory,
QKeySequence(),
(priorityLast+7),
Priorities::AddMouseArea,
&addMouseAreaFill,
&addMouseAreaFillCheck,
&singleSelection));
@@ -1863,12 +1874,12 @@ void DesignerActionManager::createDefaultDesignerActions()
&singleSelectedAndUiFile));
addDesignerAction(new ModelNodeContextMenuAction(
moveToComponentCommandId,
moveToComponentDisplayName,
makeComponentCommandId,
makeComponentDisplayName,
{},
rootCategory,
QKeySequence(),
44,
Priorities::ComponentActions + 1,
&moveToComponent,
&singleSelection,
&singleSelection));
@@ -1889,14 +1900,14 @@ void DesignerActionManager::createDefaultDesignerActions()
{},
rootCategory,
{},
50,
Priorities::MergeWithTemplate,
[&] (const SelectionContext& context) { mergeWithTemplate(context, m_externalDependencies); },
&SelectionContextFunctors::always));
addDesignerAction(new ActionGroup(
"",
genericToolBarCategory,
priorityGenericToolBar));
Priorities::GenericToolBar));
addDesignerAction(new ChangeStyleAction());
@@ -1908,7 +1919,7 @@ void DesignerActionManager::createDefaultDesignerActions()
{},
rootCategory,
QKeySequence(),
66,
Priorities::SignalsDialog,
&openSignalDialog,
&singleSelectionAndHasSlotTrigger));
@@ -1918,7 +1929,7 @@ void DesignerActionManager::createDefaultDesignerActions()
{},
rootCategory,
QKeySequence(),
priorityGenericToolBar,
Priorities::GenericToolBar,
&updateImported3DAsset,
&selectionIsImported3DAsset,
&selectionIsImported3DAsset));
@@ -2048,7 +2059,7 @@ void DesignerActionManager::addTransitionEffectAction(const TypeName &typeName)
{},
ComponentCoreConstants::flowEffectCategory,
{},
typeName == "None" ? 100 : 140,
typeName == "None" ? 11 : 1,
[typeName](const SelectionContext &context)
{ ModelNodeOperations::addFlowEffect(context, typeName); },
&isFlowTransitionItem));
@@ -2062,7 +2073,7 @@ void DesignerActionManager::addCustomTransitionEffectAction()
{},
ComponentCoreConstants::flowEffectCategory,
{},
80,
21,
&ModelNodeOperations::addCustomFlowEffect,
&isFlowTransitionItem));
}

View File

@@ -42,7 +42,7 @@ void populateMenu(QSet<ActionInterface* > &actionInterfaces,
QList<ActionInterface* > matchingFactoriesList = Utils::toList(matchingFactories);
Utils::sort(matchingFactoriesList, [](ActionInterface *l, ActionInterface *r) {
return l->priority() > r->priority();
return l->priority() < r->priority();
});
for (ActionInterface* actionInterface : std::as_const(matchingFactoriesList)) {

View File

@@ -258,7 +258,7 @@ void ViewManager::registerNanotraceActions()
QObject::tr("Start Nanotrace"),
ComponentCoreConstants::eventListCategory,
QKeySequence(),
220,
22,
handleShutdownNanotraceAction);
QObject::connect(startNanotraceAction->defaultAction(), &QAction::triggered, [&]() {
@@ -273,7 +273,7 @@ void ViewManager::registerNanotraceActions()
QObject::tr("Shut Down Nanotrace"),
ComponentCoreConstants::eventListCategory,
QKeySequence(),
220,
23,
handleShutdownNanotraceAction);
QObject::connect(shutDownNanotraceAction->defaultAction(), &QAction::triggered, [&]() {

View File

@@ -55,7 +55,7 @@ EventListAction::EventListAction()
QObject::tr("Show Event List"),
ComponentCoreConstants::eventListCategory,
QKeySequence("Alt+e"),
230,
11,
&handleAction,
&eventListEnabled)
{}
@@ -77,7 +77,7 @@ AssignEventEditorAction::AssignEventEditorAction()
QObject::tr("Assign Events to Actions"),
ComponentCoreConstants::eventListCategory,
QKeySequence("Alt+a"),
220,
21,
&handleAssignEventActionOperation,
&eventListEnabled)
{}
@@ -88,7 +88,7 @@ ConnectSignalAction::ConnectSignalAction()
assignEventListIcon(),
ComponentCoreConstants::eventListCategory,
QKeySequence(),
210,
31,
&handleAssignEventActionOperation)
{}

View File

@@ -45,7 +45,7 @@ void EventListPluginView::registerActions()
designerActionManager.addDesignerAction(new ActionGroup(tr("Event List"),
ComponentCoreConstants::eventListCategory,
ComponentCoreConstants::priorityEventListCategory,
ComponentCoreConstants::Priorities::EventListCategory,
&SelectionContextFunctors::always,
&SelectionContextFunctors::always));
auto eventListAction = new EventListAction();

View File

@@ -68,7 +68,7 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
auto layoutActionGroup = new QActionGroup(this);
layoutActionGroup->setExclusive(true);
m_noSnappingAction = layoutActionGroup->addAction(tr("No snapping"));
m_noSnappingAction = layoutActionGroup->addAction(tr("No Snapping"));
m_noSnappingAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
m_noSnappingAction->setCheckable(true);
m_noSnappingAction->setChecked(true);
@@ -77,7 +77,7 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
Constants::FORMEDITOR_NO_SNAPPING,
QKeySequence(Qt::Key_T),
ComponentCoreConstants::snappingCategory,
40);
1);
m_snappingAndAnchoringAction = layoutActionGroup->addAction(tr("Snap with Anchors"));
m_snappingAndAnchoringAction->setCheckable(true);
@@ -87,9 +87,9 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
Constants::FORMEDITOR_NO_SNAPPING_AND_ANCHORING,
QKeySequence(Qt::Key_W),
ComponentCoreConstants::snappingCategory,
10);
2);
m_snappingAction = layoutActionGroup->addAction(tr("Snap without anchors"));
m_snappingAction = layoutActionGroup->addAction(tr("Snap without Anchors"));
m_snappingAction->setCheckable(true);
m_snappingAction->setChecked(true);
@@ -97,18 +97,18 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
Constants::FORMEDITOR_SNAPPING,
QKeySequence(Qt::Key_E),
ComponentCoreConstants::snappingCategory,
20);
3);
addActions(layoutActionGroup->actions());
m_showBoundingRectAction = new QAction(tr("Show bounds"), this);
m_showBoundingRectAction = new QAction(tr("Show Bounds"), this);
m_showBoundingRectAction->setCheckable(true);
m_showBoundingRectAction->setChecked(false);
registerActionAsCommand(m_showBoundingRectAction,
Constants::FORMEDITOR_NO_SHOW_BOUNDING_RECTANGLE,
QKeySequence(Qt::Key_A),
ComponentCoreConstants::rootCategory,
10);
ComponentCoreConstants::Priorities::ShowBoundingRect);
addAction(m_showBoundingRectAction.data());
@@ -273,7 +273,7 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
Constants::FORMEDITOR_REFRESH,
QKeySequence(Qt::Key_R),
ComponentCoreConstants::rootCategory,
0);
ComponentCoreConstants::Priorities::ResetView);
addAction(m_resetAction.data());
upperActions.append(m_resetAction.data());

View File

@@ -40,59 +40,8 @@ bool modelNodeHasUrlSource(const QmlDesigner::ModelNode &modelNode)
namespace QmlDesigner {
class SourceToolAction : public AbstractAction
{
public:
SourceToolAction() : AbstractAction(QCoreApplication::translate("SourceToolAction","Change Source URL..."))
{
const Utils::Icon prevIcon({
{":/utils/images/fileopen.png", Utils::Theme::OutputPanes_NormalMessageTextColor}}, Utils::Icon::MenuTintedStyle);
action()->setIcon(prevIcon.icon());
}
QByteArray category() const override
{
return QByteArray();
}
QByteArray menuId() const override
{
return "SourceTool";
}
int priority() const override
{
return CustomActionsPriority;
}
Type type() const override
{
return FormEditorAction;
}
protected:
bool isVisible(const SelectionContext &selectionContext) const override
{
if (selectionContext.singleNodeIsSelected())
return modelNodeHasUrlSource(selectionContext.currentSingleSelectedNode());
return false;
}
bool isEnabled(const SelectionContext &selectionContext) const override
{
return isVisible(selectionContext);
}
};
SourceTool::SourceTool()
{
auto sourceToolAction = new SourceToolAction;
QmlDesignerPlugin::instance()->designerActionManager().addDesignerAction(sourceToolAction);
connect(sourceToolAction->action(), &QAction::triggered, [=]() {
view()->changeCurrentToolTo(this);
});
}
SourceTool::~SourceTool() = default;

View File

@@ -28,56 +28,8 @@
namespace QmlDesigner {
class TextToolAction : public AbstractAction
{
public:
TextToolAction() : AbstractAction(QCoreApplication::translate("TextToolAction","Edit Text")) {}
QByteArray category() const override
{
return QByteArray();
}
QByteArray menuId() const override
{
return "TextTool";
}
int priority() const override
{
return CustomActionsPriority;
}
Type type() const override
{
return ContextMenuAction;
}
protected:
bool isVisible(const SelectionContext &selectionContext) const override
{
if (selectionContext.scenePosition().isNull())
return false;
if (selectionContext.singleNodeIsSelected())
return selectionContext.currentSingleSelectedNode().metaInfo().hasProperty("text");
return false;
}
bool isEnabled(const SelectionContext &selectionContext) const override
{
return isVisible(selectionContext);
}
};
TextTool::TextTool()
{
auto textToolAction = new TextToolAction;
QmlDesignerPlugin::instance()->designerActionManager().addDesignerAction(textToolAction);
connect(textToolAction->action(), &QAction::triggered, [=]() {
view()->changeCurrentToolTo(this);
});
}
TextTool::~TextTool() = default;

View File

@@ -20,7 +20,6 @@ const int timelineBounds = 8;
const int timelineLeftOffset = 10;
const char timelineCategory[] = "Timeline";
const int priorityTimelineCategory = 110;
const char timelineCategoryDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Timeline");
const char timelineCopyKeyframesDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu",
@@ -28,7 +27,7 @@ const char timelineCopyKeyframesDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerCo
const char timelinePasteKeyframesDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu",
"Paste Keyframes");
const char timelineInsertKeyframesDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu",
"Add Keyframes at Current Frame");
"Add Keyframe");
const char timelineDeleteKeyframesDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu",
"Delete All Keyframes");

View File

@@ -584,7 +584,7 @@ void TimelineView::registerActions()
actionManager.addDesignerAction(new ActionGroup(TimelineConstants::timelineCategoryDisplayName,
TimelineConstants::timelineCategory,
TimelineConstants::priorityTimelineCategory,
ComponentCoreConstants::Priorities::TimelineCategory,
timelineEnabled,
&SelectionContextFunctors::always));
@@ -594,7 +594,7 @@ void TimelineView::registerActions()
{},
TimelineConstants::timelineCategory,
QKeySequence(),
160,
3,
deleteKeyframes,
timelineHasKeyframes));
@@ -604,7 +604,7 @@ void TimelineView::registerActions()
{},
TimelineConstants::timelineCategory,
QKeySequence(),
140,
1,
insertKeyframes,
timelineHasKeyframes));
@@ -614,7 +614,7 @@ void TimelineView::registerActions()
{},
TimelineConstants::timelineCategory,
QKeySequence(),
120,
4,
copyKeyframes,
timelineHasKeyframes));
@@ -624,7 +624,7 @@ void TimelineView::registerActions()
{},
TimelineConstants::timelineCategory,
QKeySequence(),
100,
5,
pasteKeyframes,
timelineHasClipboard));
}

View File

@@ -8,6 +8,7 @@ namespace Constants {
const char C_BACKSPACE[] = "QmlDesigner.Backspace";
const char C_DELETE[] = "QmlDesigner.Delete";
const char C_DUPLICATE[] = "QmlDesigner.Duplicate";
// Context
const char C_QMLDESIGNER[] = "QmlDesigner::QmlDesignerMain";

View File

@@ -65,7 +65,7 @@ QmlPreviewAction::QmlPreviewAction() : ModelNodeAction(livePreviewId,
QmlPreviewWidgetPlugin::tr("Show Live Preview"),
ComponentCoreConstants::qmlPreviewCategory,
QKeySequence("Alt+p"),
20,
1,
&handleAction,
&SelectionContextFunctors::always)
{

View File

@@ -40,7 +40,7 @@ QmlPreviewWidgetPlugin::QmlPreviewWidgetPlugin()
designerActionManager.addDesignerAction(new ActionGroup(
QString(),
ComponentCoreConstants::qmlPreviewCategory,
ComponentCoreConstants::priorityQmlPreviewCategory,
ComponentCoreConstants::Priorities::QmlPreviewCategory,
&SelectionContextFunctors::always));
s_previewPlugin = getPreviewPlugin();

View File

@@ -31,6 +31,7 @@
#include <qmljs/qmljsreformatter.h>
#include "modelnodecontextmenu_helper.h"
#include "qmldesignerconstants.h"
#include "qmldesignerplugin.h"
@@ -40,16 +41,17 @@
namespace QmlDesigner {
ShortCutManager::ShortCutManager()
: QObject()
, m_exportAsImageAction(tr("Export as Image..."))
, m_undoAction(tr("&Undo"))
, m_redoAction(tr("&Redo"))
, m_deleteAction(tr("Delete"))
, m_cutAction(tr("Cu&t"))
, m_copyAction(tr("&Copy"))
, m_pasteAction(tr("&Paste"))
, m_selectAllAction(tr("Select &All"))
, m_escapeAction(this)
: QObject(),
m_exportAsImageAction(tr("Export as &Image...")),
m_undoAction(tr("&Undo")),
m_redoAction(tr("&Redo")),
m_deleteAction(tr("Delete")),
m_cutAction(tr("Cu&t")),
m_copyAction(tr("&Copy")),
m_pasteAction(tr("&Paste")),
m_duplicateAction(tr("&Duplicate")),
m_selectAllAction(tr("Select &All")),
m_escapeAction(this)
{
}
@@ -70,6 +72,8 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex
connect(&m_deleteAction, &QAction::triggered, this, &ShortCutManager::deleteSelected);
connect(&m_duplicateAction, &QAction::triggered, this, &ShortCutManager::duplicateSelected);
connect(&m_cutAction, &QAction::triggered, this, &ShortCutManager::cutSelected);
connect(&m_copyAction, &QAction::triggered, this, &ShortCutManager::copySelected);
@@ -126,10 +130,13 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex
// Undo / Redo
command = Core::ActionManager::registerAction(&m_undoAction, Core::Constants::UNDO, qmlDesignerMainContext);
designerActionManager.addCreatorCommand(command, ComponentCoreConstants::editCategory, 310, Utils::Icons::UNDO_TOOLBAR.icon());
command->setDefaultKeySequence(QKeySequence::Undo);
designerActionManager.addCreatorCommand(command, ComponentCoreConstants::editCategory, 1, Utils::Icons::UNDO_TOOLBAR.icon());
command = Core::ActionManager::registerAction(&m_redoAction, Core::Constants::REDO, qmlDesignerMainContext);
designerActionManager.addCreatorCommand(command, ComponentCoreConstants::editCategory, 300, Utils::Icons::REDO_TOOLBAR.icon());
command->setDefaultKeySequence(QKeySequence::Redo);
designerActionManager.addCreatorCommand(command, ComponentCoreConstants::editCategory, 2, Utils::Icons::REDO_TOOLBAR.icon());
designerActionManager.addDesignerAction(new SeperatorDesignerAction(ComponentCoreConstants::editCategory, 10));
//Edit Menu
m_deleteAction.setIcon(QIcon::fromTheme(QLatin1String("edit-cut"), Utils::Icons::EDIT_CLEAR_TOOLBAR.icon()));
@@ -140,28 +147,34 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex
command->setAttribute(Core::Command::CA_Hide); // don't show delete in other modes
if (!Utils::HostOsInfo::isMacHost())
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
designerActionManager.addCreatorCommand(command, ComponentCoreConstants::editCategory, 280);
designerActionManager.addCreatorCommand(command, ComponentCoreConstants::editCategory, 14);
Core::ActionManager::registerAction(&m_cutAction, Core::Constants::CUT, qmlDesignerFormEditorContext);
Core::ActionManager::registerAction(&m_cutAction, Core::Constants::CUT, qmlDesignerEditor3DContext);
command = Core::ActionManager::registerAction(&m_cutAction, Core::Constants::CUT, qmlDesignerNavigatorContext);
command->setDefaultKeySequence(QKeySequence::Cut);
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
designerActionManager.addCreatorCommand(command, ComponentCoreConstants::editCategory, 260, Utils::Icons::CUT_TOOLBAR.icon());
designerActionManager.addCreatorCommand(command, ComponentCoreConstants::editCategory, 13, Utils::Icons::CUT_TOOLBAR.icon());
Core::ActionManager::registerAction(&m_copyAction, Core::Constants::COPY, qmlDesignerFormEditorContext);
Core::ActionManager::registerAction(&m_copyAction, Core::Constants::COPY, qmlDesignerEditor3DContext);
command = Core::ActionManager::registerAction(&m_copyAction, Core::Constants::COPY, qmlDesignerNavigatorContext);
command->setDefaultKeySequence(QKeySequence::Copy);
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
designerActionManager.addCreatorCommand(command, ComponentCoreConstants::editCategory, 250, Utils::Icons::COPY_TOOLBAR.icon());
designerActionManager.addCreatorCommand(command, ComponentCoreConstants::editCategory, 11, Utils::Icons::COPY_TOOLBAR.icon());
Core::ActionManager::registerAction(&m_pasteAction, Core::Constants::PASTE, qmlDesignerFormEditorContext);
Core::ActionManager::registerAction(&m_pasteAction, Core::Constants::PASTE, qmlDesignerEditor3DContext);
command = Core::ActionManager::registerAction(&m_pasteAction, Core::Constants::PASTE, qmlDesignerNavigatorContext);
command->setDefaultKeySequence(QKeySequence::Paste);
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
designerActionManager.addCreatorCommand(command, ComponentCoreConstants::editCategory, 240, Utils::Icons::PASTE_TOOLBAR.icon());
designerActionManager.addCreatorCommand(command, ComponentCoreConstants::editCategory, 12, Utils::Icons::PASTE_TOOLBAR.icon());
Core::ActionManager::registerAction(&m_duplicateAction, Constants::C_DUPLICATE, qmlDesignerFormEditorContext);
Core::ActionManager::registerAction(&m_duplicateAction, Constants::C_DUPLICATE, qmlDesignerEditor3DContext);
command = Core::ActionManager::registerAction(&m_duplicateAction, Constants::C_DUPLICATE, qmlDesignerMainContext);
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
designerActionManager.addCreatorCommand(command, ComponentCoreConstants::editCategory, 15);
Core::ActionManager::registerAction(&m_selectAllAction, Core::Constants::SELECTALL, qmlDesignerFormEditorContext);
command = Core::ActionManager::registerAction(&m_selectAllAction, Core::Constants::SELECTALL, qmlDesignerNavigatorContext);
@@ -258,6 +271,12 @@ void ShortCutManager::copySelected()
currentDesignDocument()->copySelected();
}
void ShortCutManager::duplicateSelected()
{
if (currentDesignDocument())
currentDesignDocument()->duplicateSelected();
}
void ShortCutManager::paste()
{
if (currentDesignDocument())

View File

@@ -41,6 +41,7 @@ private:
void deleteSelected();
void cutSelected();
void copySelected();
void duplicateSelected();
void paste();
void selectAll();
void undoAvailable(bool isAvailable);
@@ -61,6 +62,7 @@ private:
QAction m_cutAction;
QAction m_copyAction;
QAction m_pasteAction;
QAction m_duplicateAction;
QAction m_selectAllAction;
QAction m_escapeAction;