Qml cannot install my private module while building
-
Hello everyone im stuck with this, i believe there is no syntax error and i will just simply paste my code here to explain;
execom.h
@#ifndef EXECOM
#define EXECOM
#include <QObject>class Execom : public QObject
{
Q_OBJECTpublic:
Execom(QObject *parent = 0);
signals:public slots:
void runcom(const char *cmd);
};
#endif // EXECOM
@execom.cpp
@
#include <execom.h>
#include <stdlib.h>
#include <unistd.h>Execom::Execom(QObject *parent):
QObject(parent)
{}void Execom::runcom(const char *cmd){
system(cmd);
}
@main.cpp
@
#include <QApplication>
#include <QQmlApplicationEngine>#include "execom.h"
#include <QtQml>int main(int argc, char *argv[])
{
QApplication app(argc, argv);QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); qmlRegisterType<Execom>("Komut",1,0,"Execom"); return app.exec();
}
@main.qml
@
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Window 2.2
import QtQuick.Dialogs 1.2
import Komut 1.0 // according to error this modul is not installedApplicationWindow {
...
Execom
{
id:kod} MainForm { anchors.fill: parent button1.onClicked: fileDialog.open() button2.onClicked: { command+="tiff2pdf -o /home/stajer/Masaüstü/output.pdf "+texturl console.log(""+command) kod.runcom(command) messageDialog.show(qsTr("Button 2 pressed")) } }
FileDialog {
...
@
the pro file
@
TEMPLATE = appQT += qml quick widgets
SOURCES += main.cpp
execom.cppRESOURCES += qml.qrc
Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
Default rules for deployment.
include(deployment.pri)
HEADERS +=
execom.h
@and the error is this :
QQmlApplicationEngine failed to load component
qrc:/main.qml:5 module "Komut" is not installedI really can use your help.
-
Hi and welcome to devnet,
IIRC you should register your types before loading your qml file