I just shortly looked at the patch. It indeed relies on a qrc location. 
This will only work if the contributing plug-in is loaded (otherwise, 
the Qt resources would not be accessible). The final fix should rely on 
the CTK resource system to retrieve the icon (as specified in the 
CACHED_RESOURCE_FILES variable) and create a QIcon instance from an 
in-memory representation of the icon similar to the code creating the 
MITK Workbench toolbar and menu entries showing the view icons.

Best,
Sascha

On 11/09/2014 10:27 PM, Rostislav Khlebnikov wrote:
> Hm, setting it to the "qrc" location (i.e. ":/icons/icon.png") seems to
> work.
>
> All best,
>     Rostislav.
>
> On 09/11/2014 20:41, Rostislav Khlebnikov wrote:
>> Hi guys,
>>
>> am I missing something? I applied the patch attached to the bug, but the
>> icon is still missing.
>>
>> I added my icon to the CACHED_RESOURCE_FILES in files.cmake for my
>> plugin. The location is, say, "resources/icon.png" and in plugin.xml I have
>> <contextMenuAction nodeDescriptorName="mydescriptor" label="My label"
>> icon="resources/icon.png" class="MyAction" />
>>
>> Any ideas on why this might not work?
>>
>> Thanks,
>>      Rostislav.
>>
>> On 10/07/2014 10:43, Martin Klemm wrote:
>>> Hi Sascha,
>>>
>>> thanks for the answer and sorry for not writing you for so long. I
>>> opened a bug report http://bugs.mitk.org/show_bug.cgi?id=17907 and
>>> attached the patch file. Is there something else I have to do now? Or
>>> will you do the rest?
>>>
>>> Best regards,
>>>
>>> Martin
>>>
>>>
>>>
>>> On 28.05.2014 18:09, Sascha Zelzer wrote:
>>>> Hi Martin,
>>>>
>>>> I think it just hasn't been done yet. I also don't see a reason for not
>>>> doing it. Would you be up for contributing a patch to enable icons in
>>>> the context menu?
>>>>
>>>> Thanks,
>>>>
>>>> Sascha
>>>>
>>>> On 05/06/2014 10:37 AM, Martin Klemm wrote:
>>>>> Hello,
>>>>>
>>>>> I was successful in adding a new context menu action to the data manager
>>>>> menu:
>>>>>
>>>>>       <extension point="org.mitk.gui.qt.datamanager.contextMenuActions">
>>>>>           <contextMenuAction nodeDescriptorName="Unknown" label="Group"
>>>>> icon="resources/grouping_icon.png" class="GroupAction" />
>>>>>       </extension>
>>>>>
>>>>> The action is shown and works as expected, however, the icon is missing.
>>>>> 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);
>>>>> ...
>>>>>
>>>>> Is there a reason why the icon is not used?
>>>>>
>>>>> Best regards,
>>>>>
>>>>> Martin
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>>
>>>>> Is your legacy SCM system holding you back? Join Perforce May 7 to
>>>>> find out:
>>>>> &#149; 3 signs your SCM is hindering your productivity
>>>>> &#149; Requirements for releasing software faster
>>>>> &#149; Expert tips and advice for migrating your SCM now
>>>>> http://p.sf.net/sfu/perforce
>>>>> _______________________________________________
>>>>> mitk-users mailing list
>>>>> mitk-users@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/mitk-users
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> mitk-users mailing list
>> mitk-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/mitk-users
>
> ------------------------------------------------------------------------------
> _______________________________________________
> mitk-users mailing list
> mitk-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mitk-users


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to