diff --git a/kdevplatform/sublime/idealdockwidget.cpp b/kdevplatform/sublime/idealdockwidget.cpp --- a/kdevplatform/sublime/idealdockwidget.cpp +++ b/kdevplatform/sublime/idealdockwidget.cpp @@ -100,7 +100,14 @@ QList< QAction* > viewActions = m_view->contextMenuActions(); if(!viewActions.isEmpty()) { - menu.addActions(viewActions); + // add the view's actions to the context menu, + // checking each if it can be represented + foreach (const auto action, viewActions) { + if (!action->text().isEmpty() && !action->iconText().isEmpty()) { + // avoid adding empty menu items + menu.addAction(action); + } + } menu.addSeparator(); } diff --git a/plugins/contextbrowser/contextbrowserview.cpp b/plugins/contextbrowser/contextbrowserview.cpp --- a/plugins/contextbrowser/contextbrowserview.cpp +++ b/plugins/contextbrowser/contextbrowserview.cpp @@ -182,6 +182,9 @@ m_declarationMenuAction = new QAction(QIcon::fromTheme(QStringLiteral("code-class")), QString(), this); m_declarationMenuAction->setToolTip(i18n("Declaration menu")); + // expose the declaration menu via the context menu; allows hiding the toolbar to save some space + // (this will not make it behave like a submenu though) + m_declarationMenuAction->setText(m_declarationMenuAction->toolTip()); connect(m_declarationMenuAction, &QAction::triggered, this, &ContextBrowserView::declarationMenu); addAction(m_declarationMenuAction); m_lockAction = new KToggleAction(QIcon::fromTheme(QStringLiteral("object-unlocked")), i18n("Lock Current View"), this); diff --git a/plugins/outlineview/outlinewidget.cpp b/plugins/outlineview/outlinewidget.cpp --- a/plugins/outlineview/outlinewidget.cpp +++ b/plugins/outlineview/outlinewidget.cpp @@ -57,6 +57,8 @@ // sort action m_sortAlphabeticallyAction = new QAction(QIcon::fromTheme(QStringLiteral("view-sort-ascending")), QString(), this); m_sortAlphabeticallyAction->setToolTip(i18n("Sort alphabetically")); + // reuse the tooltip so the action will show up in the context menu: + m_sortAlphabeticallyAction->setText(m_sortAlphabeticallyAction->toolTip()); m_sortAlphabeticallyAction->setCheckable(true); connect(m_sortAlphabeticallyAction, &QAction::triggered, this, [this](bool sort) { // calling sort with -1 will restore the original order