Importing custom modules in QML registered from PySide6

Viewed 227

I am currently using VSCode to write a PySide6 application. I am designing my .qml file using Qt Design Studio.

I just added some custom class objects to QML using qmlRegisterType:

main.py

if __name__ == '__main__':
        app = QGuiApplication(sys.argv)

        engine = QQmlApplicationEngine()
        engine.quit.connect(app.quit)

        qmlRegisterType(Backend, 'Backend', 1, 0, 'Backend')
        qmlRegisterType(HistoryListModel, 'HistoryListModel', 1, 0, 'HistoryListModel')
        engine.load('main.qml')

        sys.exit(app.exec())

main.qml

import QtQuick 2.15
import QtQuick.Window 2.11
import QtQuick.Controls.Material 2.12
import QtQuick.Controls 2.15
import Backend 1.0 
import HistoryListModel 1.0 

QML module not found (Backend).

QML module not found (HistoryListModel).

This leads to Qt Design Studio no longer allows me to use the graphical design tool, which is kind of annoying.

How do I include the QML modules that has been added through qmlRegisterType so that Qt Design Studio finds them?

0 Answers
Related