2

Does anyone know if there is an opportunity to add icons for your own plug-in in its own repository? like this

enter image description here

not like this

enter image description here

with green puzzle

other illustration

enter image description here

I spied on how to implement it on the official website here (view-source). File plugins.xml including the tag contains for example

<icon>/static/packages/2015/icon_217.png</icon>

where I added a similar relative path to my image (with and without leading slash)

<icon>/favicon.png</icon>,

but it does not appear in the list of plugins. I did absolute path

<icon>http://foo.bar.spam.ru/favicon.png</icon>

but nothing had changed.

2 Answers2

3

Thank you all for your advice.

I found a solution (by accident) there is somehow not very obvious described - but it was necessary to file metadata.txt correct icons=desired_file.png. resource.py for another bit.

  • Great! I forgot about metadata :( – Zoltan Feb 12 '16 at 14:08
  • All very strange that the map icons for installed plugins. In plugins.xml have the right tag (icon) could handle at this location and take (if found) the picture, and what-have much not to load too much to do pagination. P.S. Sorry for my english google translate not very helped me) – Alexander Kamenev Feb 13 '16 at 05:39
2
  1. Create a png file (23 x 24 pixel)
  2. Create a resources.qrc file like this:

    <RCC> <qresource prefix="/plugins/your_plugin_dir" > <file>icon.png</file> </qresource> </RCC>

3.Compile the resource file to python

pyrcc4 -o resources_rc.py resources.qrc
  1. Import the resources_rc.py file into your main plugin file

    import resources_rc

If you use the PluginBuilder the resources.qrc and a Makefile are automaticly generated.

In the initGui method of the plugin you can add the same icon to toolbar and/or menu.

Zoltan
  • 7,325
  • 17
  • 27