[QGIS-Developer] Creating & loading Qt6 resource files for python plugins
Ujaval Gandhi
ujaval at spatialthoughts.com
Thu Jan 8 20:17:45 PST 2026
I also do not use the resource files anymore. You can use the logo directly in
plugins without compilation as shown by Etienne which makes the development much
simpler.
---
Ujaval Gandhi
Spatial Thoughts
www.spatialthoughts.com [http://www.spatialthoughts.com]
On Thu, Jan 8, 2026 at 4:52 PM Etienne Trimaille via QGIS-Developer
<qgis-developer at lists.osgeo.org> wrote:
> 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,
>
> [data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=3D]
> Le jeu. 8 janv. 2026 à 11:43, Benjamin Jakimow via QGIS-Developer
> <qgis-developer at lists.osgeo.org [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-
> > [https://github.com/qgis/QGIS-]
> > > Enhancement-Proposals/pull/359 <https://github.com/qgis/QGIS-
> > [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 [QGIS-Developer at lists.osgeo.org]
> > > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> > [https://lists.osgeo.org/mailman/listinfo/qgis-developer]
> > > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> > [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
> > [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 [http://hu-berlin.de]
> > web: https://eolab.geographie.hu-berlin.de/
> > [https://eolab.geographie.hu-berlin.de/]
> >
> > _______________________________________________
> > QGIS-Developer mailing list
> > QGIS-Developer at lists.osgeo.org [QGIS-Developer at lists.osgeo.org]
> > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> > [https://lists.osgeo.org/mailman/listinfo/qgis-developer]
> > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> > [https://lists.osgeo.org/mailman/listinfo/qgis-developer]
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org [QGIS-Developer at lists.osgeo.org]
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> [https://lists.osgeo.org/mailman/listinfo/qgis-developer]
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> [https://lists.osgeo.org/mailman/listinfo/qgis-developer]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20260109/301b14ba/attachment.htm>
More information about the QGIS-Developer
mailing list