I am creating a build script for a PyQt6/QML app and I want to embed a bunch of SVG icons into QML. I am trying out the 'official' approach (link to Qt website), so I created an icons.qrc file with the following content:
<!DOCTYPE RCC><RCC version="6.2.4">
<qresource>
<file>icons/info.svg</file>
</qresource>
</RCC>
and then compiled it with rcc -g python icons.qrc > icons.py, producing a Python file that looks like this:
# Resource object code (Python 3)
# Created by: object code
# Created by: The Resource Compiler for Qt version 6.2.4
# WARNING! All changes made in this file will be lost!
from PySide6 import QtCore
qt_resource_data = b"..."
qt_resource_name = b"..."
qt_resource_struct = b"..."
def qInitResources():
QtCore.qRegisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
def qCleanupResources():
QtCore.qUnregisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
qInitResources()
However, I don't know what to do next. How do I get the icons into QML?