QmlDesigner: Raise and Lower should be ModelNodeContextMenuAction

Otherwise the action shows up in the form editor.

Change-Id: If61fbeb8fefe2f7db1ab9cb5cdd5756b3bcaa9de
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2018-08-30 14:46:49 +02:00
parent 693c6dcc0b
commit cfab83d9fe
2 changed files with 22 additions and 9 deletions

View File

@@ -196,7 +196,7 @@ public:
SelectionContextOperation action, SelectionContextOperation action,
SelectionContextPredicate enabled = &SelectionContextFunctors::always, SelectionContextPredicate enabled = &SelectionContextFunctors::always,
SelectionContextPredicate visibility = &SelectionContextFunctors::always) : SelectionContextPredicate visibility = &SelectionContextFunctors::always) :
ModelNodeContextMenuAction(id, description, category, key, priority, action, enabled, visibility) ModelNodeContextMenuAction(id, description, {}, category, key, priority, action, enabled, visibility)
{} {}
void updateContext() override void updateContext() override
@@ -223,7 +223,7 @@ public:
SelectionContextOperation action, SelectionContextOperation action,
SelectionContextPredicate enabled = &SelectionContextFunctors::always, SelectionContextPredicate enabled = &SelectionContextFunctors::always,
SelectionContextPredicate visibility = &SelectionContextFunctors::always) : SelectionContextPredicate visibility = &SelectionContextFunctors::always) :
ModelNodeContextMenuAction(id, description, category, key, priority, action, enabled, visibility) ModelNodeContextMenuAction(id, description, {}, category, key, priority, action, enabled, visibility)
{} {}
void updateContext() override void updateContext() override
{ {
@@ -657,6 +657,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new ModelNodeContextMenuAction( addDesignerAction(new ModelNodeContextMenuAction(
toFrontCommandId, toFrontCommandId,
toFrontDisplayName, toFrontDisplayName,
{},
stackCategory, stackCategory,
QKeySequence(), QKeySequence(),
200, 200,
@@ -666,27 +667,26 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new ModelNodeContextMenuAction( addDesignerAction(new ModelNodeContextMenuAction(
toBackCommandId, toBackCommandId,
toBackDisplayName, toBackDisplayName,
{},
stackCategory, stackCategory,
QKeySequence(), QKeySequence(),
180, 180,
&toBack, &toBack,
&singleSelection)); &singleSelection));
addDesignerAction(new ModelNodeFormEditorAction( addDesignerAction(new ModelNodeContextMenuAction(
raiseCommandId, raiseDisplayName, raiseCommandId, raiseDisplayName,
Utils::Icon({{":/qmldesigner/icon/designeractions/images/raise.png", Utils::Theme::IconsBaseColor}}).icon(), Utils::Icon({{":/qmldesigner/icon/designeractions/images/raise.png", Utils::Theme::IconsBaseColor}}).icon(),
raiseToolTip,
stackCategory, stackCategory,
QKeySequence(), QKeySequence(),
160, 160,
&raise, &raise,
&raiseAvailable)); &raiseAvailable));
addDesignerAction(new ModelNodeFormEditorAction( addDesignerAction(new ModelNodeContextMenuAction(
lowerCommandId, lowerCommandId,
lowerDisplayName, lowerDisplayName,
Utils::Icon({{":/qmldesigner/icon/designeractions/images/lower.png", Utils::Theme::IconsBaseColor}}).icon(), Utils::Icon({{":/qmldesigner/icon/designeractions/images/lower.png", Utils::Theme::IconsBaseColor}}).icon(),
lowerToolTip,
stackCategory, stackCategory,
QKeySequence(), QKeySequence(),
140, 140,
@@ -698,6 +698,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new ModelNodeContextMenuAction( addDesignerAction(new ModelNodeContextMenuAction(
resetZCommandId, resetZCommandId,
resetZDisplayName, resetZDisplayName,
{},
stackCategory, stackCategory,
QKeySequence(), QKeySequence(),
100, 100,
@@ -793,6 +794,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new ModelNodeContextMenuAction( addDesignerAction(new ModelNodeContextMenuAction(
removePositionerCommandId, removePositionerCommandId,
removePositionerDisplayName, removePositionerDisplayName,
{},
positionCategory, positionCategory,
QKeySequence("Ctrl+Shift+p"), QKeySequence("Ctrl+Shift+p"),
210, 210,
@@ -803,6 +805,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new ModelNodeContextMenuAction( addDesignerAction(new ModelNodeContextMenuAction(
layoutRowPositionerCommandId, layoutRowPositionerCommandId,
layoutRowPositionerDisplayName, layoutRowPositionerDisplayName,
{},
positionCategory, positionCategory,
QKeySequence(), QKeySequence(),
200, 200,
@@ -813,6 +816,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new ModelNodeContextMenuAction( addDesignerAction(new ModelNodeContextMenuAction(
layoutColumnPositionerCommandId, layoutColumnPositionerCommandId,
layoutColumnPositionerDisplayName, layoutColumnPositionerDisplayName,
{},
positionCategory, positionCategory,
QKeySequence(), QKeySequence(),
180, 180,
@@ -823,6 +827,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new ModelNodeContextMenuAction( addDesignerAction(new ModelNodeContextMenuAction(
layoutGridPositionerCommandId, layoutGridPositionerCommandId,
layoutGridPositionerDisplayName, layoutGridPositionerDisplayName,
{},
positionCategory, positionCategory,
QKeySequence(), QKeySequence(),
160, 160,
@@ -833,6 +838,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new ModelNodeContextMenuAction( addDesignerAction(new ModelNodeContextMenuAction(
layoutFlowPositionerCommandId, layoutFlowPositionerCommandId,
layoutFlowPositionerDisplayName, layoutFlowPositionerDisplayName,
{},
positionCategory, positionCategory,
QKeySequence("Ctrl+m"), QKeySequence("Ctrl+m"),
140, 140,
@@ -845,6 +851,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new ModelNodeContextMenuAction( addDesignerAction(new ModelNodeContextMenuAction(
removeLayoutCommandId, removeLayoutCommandId,
removeLayoutDisplayName, removeLayoutDisplayName,
{},
layoutCategory, layoutCategory,
QKeySequence(), QKeySequence(),
110, 110,
@@ -867,6 +874,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new ModelNodeContextMenuAction( addDesignerAction(new ModelNodeContextMenuAction(
addTabBarToStackedContainerCommandId, addTabBarToStackedContainerCommandId,
addTabBarToStackedContainerDisplayName, addTabBarToStackedContainerDisplayName,
{},
stackedContainerCategory, stackedContainerCategory,
QKeySequence("Ctrl+Shift+t"), QKeySequence("Ctrl+Shift+t"),
100, 100,
@@ -958,6 +966,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new ModelNodeContextMenuAction( addDesignerAction(new ModelNodeContextMenuAction(
goIntoComponentCommandId, goIntoComponentCommandId,
goIntoComponentDisplayName, goIntoComponentDisplayName,
{},
rootCategory, rootCategory,
QKeySequence(Qt::Key_F2), QKeySequence(Qt::Key_F2),
priorityGoIntoComponent, priorityGoIntoComponent,
@@ -967,6 +976,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new ModelNodeContextMenuAction( addDesignerAction(new ModelNodeContextMenuAction(
goToImplementationCommandId, goToImplementationCommandId,
goToImplementationDisplayName, goToImplementationDisplayName,
{},
rootCategory, rootCategory,
QKeySequence(), QKeySequence(),
42, 42,
@@ -977,6 +987,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new ModelNodeContextMenuAction( addDesignerAction(new ModelNodeContextMenuAction(
addSignalHandlerCommandId, addSignalHandlerCommandId,
addSignalHandlerDisplayName, addSignalHandlerDisplayName,
{},
rootCategory, QKeySequence(), rootCategory, QKeySequence(),
42, &addNewSignalHandler, 42, &addNewSignalHandler,
&singleSelectedAndUiFile, &singleSelectedAndUiFile,
@@ -985,6 +996,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new ModelNodeContextMenuAction( addDesignerAction(new ModelNodeContextMenuAction(
moveToComponentCommandId, moveToComponentCommandId,
moveToComponentDisplayName, moveToComponentDisplayName,
{},
rootCategory, rootCategory,
QKeySequence(), QKeySequence(),
44, 44,

View File

@@ -192,7 +192,7 @@ private:
class ModelNodeContextMenuAction : public AbstractAction class ModelNodeContextMenuAction : public AbstractAction
{ {
public: public:
ModelNodeContextMenuAction(const QByteArray &id, const QString &description, const QByteArray &category, const QKeySequence &key, int priority, ModelNodeContextMenuAction(const QByteArray &id, const QString &description, const QIcon &icon, const QByteArray &category, const QKeySequence &key, int priority,
SelectionContextOperation selectionAction, SelectionContextOperation selectionAction,
SelectionContextPredicate enabled = &SelectionContextFunctors::always, SelectionContextPredicate enabled = &SelectionContextFunctors::always,
SelectionContextPredicate visibility = &SelectionContextFunctors::always) : SelectionContextPredicate visibility = &SelectionContextFunctors::always) :
@@ -204,6 +204,7 @@ public:
m_visibility(visibility) m_visibility(visibility)
{ {
action()->setShortcut(key); action()->setShortcut(key);
action()->setIcon(icon);
} }
bool isVisible(const SelectionContext &selectionState) const override { return m_visibility(selectionState); } bool isVisible(const SelectionContext &selectionState) const override { return m_visibility(selectionState); }
@@ -233,7 +234,7 @@ public:
int priority, int priority,
SelectionContextOperation selectionAction, SelectionContextOperation selectionAction,
SelectionContextPredicate enabled = &SelectionContextFunctors::always) : SelectionContextPredicate enabled = &SelectionContextFunctors::always) :
ModelNodeContextMenuAction(id, description, category, key, priority, selectionAction, enabled, &SelectionContextFunctors::always) ModelNodeContextMenuAction(id, description, icon, category, key, priority, selectionAction, enabled, &SelectionContextFunctors::always)
{ {
action()->setIcon(icon); action()->setIcon(icon);
action()->setToolTip(tooltip); action()->setToolTip(tooltip);
@@ -255,7 +256,7 @@ public:
SelectionContextOperation selectionAction, SelectionContextOperation selectionAction,
SelectionContextPredicate enabled = &SelectionContextFunctors::always, SelectionContextPredicate enabled = &SelectionContextFunctors::always,
SelectionContextPredicate visible = &SelectionContextFunctors::always) : SelectionContextPredicate visible = &SelectionContextFunctors::always) :
ModelNodeContextMenuAction(id, description, category, key, priority, selectionAction, enabled, visible) ModelNodeContextMenuAction(id, description, icon, category, key, priority, selectionAction, enabled, visible)
{ {
action()->setIcon(icon); action()->setIcon(icon);
action()->setToolTip(tooltip); action()->setToolTip(tooltip);