我尝试注册一个类型,但出现此错误:
QQmlApplicationEngine failed to load component qrc:/main.qml:5 module "Komut" is not installed
This is the code I'm using:
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
qmlRegisterType<Execom>("Komut",1,0,"Execom");
最佳答案
取而代之的是:
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
qmlRegisterType<Execom>("Komut",1,0,"Execom");
这样做:
qmlRegisterType<Execom>("Komut",1,0,"Execom");
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
关于c++ - 错误 : QQmlApplicationEngine failed to load component,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28369294/