Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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");
like image 432
oksidez Avatar asked Feb 11 '23 00:02

oksidez


1 Answers

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")));
like image 161
cmannett85 Avatar answered Feb 13 '23 12:02

cmannett85