2

I have developed a plugin for QGIS. It has two buttons and I have to add custom icons for it. How can I create custom icons for this?

1

1 Answer 1

2

It should be rather easy to create custom icons for your QGIS plugin: It is common to create them as SVGs as they are vector graphics and scale with the resolution of the monitor. You can use OpenSource tools such as Inkscape and also proprietory software like Adobe Illustrator to create the icons. In a second step you just have to include the svg files in your plugin directory (I put it into the folder 'icons'). Then you register the specific svg file in your algorithm by implementing this method:

    def icon(self):
        return QIcon(os.path.join(pluginPath, 'PLUGIN_DIR_NAME', 'icons', 'icon.svg'))
2
  • Thanks for your ans root676,is there any open source repository for generic svg icons. Jun 10, 2020 at 18:39
  • I don't know any OpenSource platforms but you could try www.thenounproject.com - they offer (mostly) free but also Creative Commons licensed icons. But they have a huge library.
    – root676
    Jun 10, 2020 at 21:15

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.