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.

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 5: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.

  • In the previous comments I have received exactly the same answer and comment on it. – Alexander Kamenev Feb 12 '16 at 8:20
  • this icon is displayed in manage plugin dialog. Download a plugin which has a custom icon and compare to your code. – Zoltan Feb 12 '16 at 9:21
  • i found!!! In metadata.txt icon=<your file> - what is all! – Alexander Kamenev Feb 12 '16 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.