Page MenuHomePhabricator

Neglected icon attribute in the extension point of the QmitkDataManagerView
Closed, ResolvedPublic

Description

Adding a new context menu action to the data manager menu like this

<extension point="org.mitk.gui.qt.datamanager.contextMenuActions">
    <contextMenuAction nodeDescriptorName="DescriptorName" label="DescriptorLabel"

icon="resources/DescriptorIcon.png" class="DescriptorClass" />

</extension>

does not set the icon.

The action itself is shown and works as expected. In QmitkDataManagerView::CreateQtPartControl(QWidget* parent) the context menu extension service is opened to read the descriptor name, label, class and icon attribute but is not using the icon to create the action:

...
if((*cmActionsIt)->GetAttribute("nodeDescriptorName", cmNodeDescriptorName)

  && (*cmActionsIt)->GetAttribute("label", cmLabel)
  && (*cmActionsIt)->GetAttribute("class", cmClass))
{
  (*cmActionsIt)->GetAttribute("icon", cmIcon);
  // create context menu entry here
  tmpDescriptor =

QmitkNodeDescriptorManager::GetInstance()->GetDescriptor(QString::fromStdString(cmNodeDescriptorName));

contextMenuAction = new QAction( QString::fromStdString(cmLabel),

parent);

Event Timeline

The patch file contains the changes that were necessary to include the icon in the menu action. It was tested under Windows 7.

To honor the external contribution we should include this in the upcoming release although it has not a high importance set.

You might want to only add an QAction with icon if an icon was provided. Otherwise use the old way.

User klemmm has pushed new remote branch:

bug-17907-NeglectedIconAttributeInTheExtensionPointOfTheQmitkDataManagerView

[bc222c]: Merge branch 'bug-17907-NeglectedIconAttributeInTheExtensionPointOfThe

Merged commits:

2014-11-12 15:58:27 Martin Klemm [a53122]
Context menu action can be initialized with icon attribute via the extension point