[Qgis-user] Qgis 3.10 Plugin resources.qrc
Raymond Nijssen
r.nijssen at terglobo.nl
Fri Oct 23 06:27:11 PDT 2020
Hi Julierme,
You need(ed) to convert the .qrc file to a .py file with rcc. See:
https://doc.qt.io/qt-5/resources.html#resources-in-a-qt-for-python-application
But personally I'm not using it anymore, cause you can just use the .png
files straight in your code and I find it easier.
For example, I make a toolbar button with icon this way:
```
icon = QIcon(os.path.join(self.plugin_dir, 'icon.png'))
self.action = QAction(icon, 'Do something', self.iface.mainWindow())
self.action.triggered.connect(self.run_something)
self.toolbar.addAction(self.action)
```
Hope it helps!
Raymond
On 22-10-2020 21:46, 1520 gis wrote:
> Dear all,
>
> I have created a Qgis plugin and I use three images in the resources.qrc
> file shown below. Everything works fine before I restart Qgis. If I
> restart Qgis, I hit an error ModuleNotFoundError: No module named
> 'resources_rc'. And the plugin won't start. Any comment will be very
> appreciated.
>
> Thank you for your time in advance.
>
> Kind regards
>
> Julierme
>
> <RCC>
> <qresource prefix="/plugins/inde" >
> <file>icon.png</file>
> <file>censipamLogo.png</file>
> <file>indeLogo.png</file>
> </qresource>
> </RCC>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
More information about the Qgis-user
mailing list