Skip to content Skip to sidebar Skip to footer

Importing Qml From A Resource (qrc) File With Pyside2

I have added a simple QML component ('qml/MyButton') to my 'resource.qrc' file: qml/MyButton.qml

Solution 1:

Automatic import if the .qml is next to the main file but in your case MyButton.qml is not next to the main.qml so the package has to be imported:

import QtQuick 2.13
import QtQuick.Window 2.13

import "qrc:/qml"

Window {
    width: 640
    height: 480
    visible: true
    title: qsTr("Hello World")

    MyButton {
    }
}

Post a Comment for "Importing Qml From A Resource (qrc) File With Pyside2"