[QGIS-Developer] Creating & loading Qt6 resource files for python plugins
Etienne Trimaille
etienne.trimaille at gmail.com
Thu Jan 8 03:21:45 PST 2026
Hi,
Quite a few developers, like me as well, are not using resource files
anymore. It's more simple, no need to compile resource files etc. It's just
my opinion.
You can just use pathlib, for instance :
- Define a variable at the root of your plugin :
DIR_PLUGIN_ROOT = Path(__file__).parent
Then call it when you want with an icon :
QIcon(str(DIR_PLUGIN_ROOT / "resources/icons/logo.svg"))
Regards,
Le jeu. 8 janv. 2026 à 11:43, Benjamin Jakimow via QGIS-Developer <
qgis-developer at lists.osgeo.org> a écrit :
> Dear Experts,
>
> for our QGIS Python plugins we load icons into the Qt Resource system,
> so that they can be accessed as in QIcon(r':/myplugin/myicon.svg').
>
> In PyQt5 / QGIS3 we do this by:
> 1. compiling myresource.qrc files into a myresource_rc.py file, either
> using pyrcc5 (on CLI) or qgis.PyQt.pyrcc_main (in Python).
> 2. loading these icons on plugin start-up, like in:
>
> import myresource_rc
> myresource_rc.qInitResources()
>
> It seems that in QGIS4 / Qt6 neither pyrcc5 nor qgis.PyQt.pyrcc_main is
> available (tested in OSGeo4W qgis-qt6 environment).
>
> It's possible to create *_rc.py files using pyside6-rcc, but they use
> from PySide6 import QtCore
> which is not available (e.g. in the current OSGeo4W qgis-qt6 environment).
>
> Does anyone have an idea how we can create Qt6-style *._rc.py files
> instead?
>
> Greetings, Benjamin
>
>
>
> On 08.01.26 09:41, Valentin Buira via QGIS-Developer wrote:
> > Hi devs, and happy new year to you all!
> >
> > I just posted a new QEP about introducing a data viewer in the model
> > designer canvas from the. Please see: https://github.com/qgis/QGIS-
> > Enhancement-Proposals/pull/359 <https://github.com/qgis/QGIS-
> > Enhancement-Proposals/pull/359>
> >
> > This QEP aims to bring an integrated data viewer directly inside the
> > model designer to inspect and debug the state of your model as you build
> > them.
> >
> > Thanks for any feedback and cheers,
> > Valentin
> >
> > _______________________________________________
> > QGIS-Developer mailing list
> > QGIS-Developer at lists.osgeo.org
> > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
> --
> Dr. Benjamin Jakimow
> Earth Observation Lab | Geography Department | Humboldt-Universität zu
> Berlin
>
> e-mail: benjamin.jakimow at geo.hu-berlin.de
>
> phone: +49 (0) 30 2093 45846
> mobile: +49 (0) 157 5656 8477
>
> mail: Unter den Linden 6 | 10099 Berlin | Germany
> matrix: @jakimowb:hu-berlin.de
> web: https://eolab.geographie.hu-berlin.de/
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20260108/9d708ba2/attachment.htm>
More information about the QGIS-Developer
mailing list