diff --git a/src/plugins/qmldesigner/components/componentcore/actioninterface.h b/src/plugins/qmldesigner/components/componentcore/actioninterface.h index 668438218ac..b52e516954e 100644 --- a/src/plugins/qmldesigner/components/componentcore/actioninterface.h +++ b/src/plugins/qmldesigner/components/componentcore/actioninterface.h @@ -40,6 +40,7 @@ public: enum Type { ContextMenu, ContextMenuAction, + ToolBarAction, Action }; diff --git a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp index cd0e18578b2..1332e3b0546 100644 --- a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp +++ b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp @@ -24,6 +24,7 @@ ****************************************************************************/ #include "designeractionmanager.h" + #include "modelnodecontextmenu_helper.h" #include #include @@ -80,24 +81,16 @@ DesignerActionToolBar *DesignerActionManager::createToolBar(QWidget *parent) con }); bool addSeparator = false; - bool lastWasSeparator = false; for (auto *action : actions) { - if (action->type() == ActionInterface::Action - && action->action() - && !action->action()->icon().isNull()) { + if ((action->type() == ActionInterface::Action || action->type() == ActionInterface::ToolBarAction) + && action->action()) { toolBar->registerAction(action); addSeparator = true; - lastWasSeparator = false; } else if (addSeparator && action->action()->isSeparator()) { toolBar->registerAction(action); - lastWasSeparator = true; } } - - if (addSeparator && !lastWasSeparator) { - toolBar->addSeparator(); - } } return toolBar; @@ -541,6 +534,8 @@ void DesignerActionManager::createDefaultDesignerActions() &resetSize, &selectionNotEmptyAndHasWidthOrHeightProperty)); + addDesignerAction(new SeperatorDesignerAction(editCategory, 170)); + addDesignerAction(new VisiblityModelNodeAction( visiblityCommandId, visibilityDisplayName, @@ -578,6 +573,8 @@ void DesignerActionManager::createDefaultDesignerActions() &anchorsReset, &singleSelectionItemIsAnchored)); + addDesignerAction(new SeperatorDesignerAction(anchorsCategory, 170)); + addDesignerAction(new ActionGroup( positionCategoryDisplayName, positionCategory, @@ -685,6 +682,8 @@ void DesignerActionManager::createDefaultDesignerActions() &layoutGridLayout, &selectionCanBeLayoutedAndQtQuickLayoutPossible)); + addDesignerAction(new SeperatorDesignerAction(layoutCategory, 50)); + addDesignerAction(new FillWidthModelNodeAction( layoutFillWidthCommandId, layoutFillWidthDisplayName, diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu.cpp index 4139dd677fe..b449cec9a12 100644 --- a/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu.cpp +++ b/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu.cpp @@ -69,14 +69,15 @@ void populateMenu(QSet &actionInterfaces, }); foreach (ActionInterface* actionInterface, matchingFactoriesList) { - if (actionInterface->type() == ActionInterface::ContextMenu) { - actionInterface->currentContextChanged(selectionContext); - QMenu *newMenu = actionInterface->action()->menu(); - menu->addMenu(newMenu); + if (actionInterface->type() == ActionInterface::ContextMenu) { + actionInterface->currentContextChanged(selectionContext); + QMenu *newMenu = actionInterface->action()->menu(); + if (newMenu && !newMenu->title().isEmpty()) + menu->addMenu(newMenu); - //recurse + //recurse - populateMenu(actionInterfaces, actionInterface->menuId(), newMenu, selectionContext); + populateMenu(actionInterfaces, actionInterface->menuId(), newMenu, selectionContext); } else if (actionInterface->type() == ActionInterface::ContextMenuAction || actionInterface->type() == ActionInterface::Action) { QAction* action = actionInterface->action();