oksidez
oksidez

Reputation: 71

Error: QQmlApplicationEngine failed to load component

I try to register a type, but I'm getting this error:

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");

Upvotes: 4

Views: 20904

Answers (1)

cmannett85
cmannett85

Reputation: 22346

Instead of this:

QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
qmlRegisterType<Execom>("Komut",1,0,"Execom");

Do this:

qmlRegisterType<Execom>("Komut",1,0,"Execom");
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

Upvotes: 8

Related Questions