Error in runtime module "Customer" is not installed
-
Hello
I am having problem registering a C++ class as QML type.
Compilation haw no errors but on runtime i get the error that module "Customer" is not installed
Here is my code
customer.h
@class Customer : public QObject
{
Q_OBJECTpublic:
explicit Customer(QObject *parent = 0);
Q_INVOKABLE void setQuery(const QString &query, const QSqlDatabase &db = QSqlDatabase());
Q_INVOKABLE void setQuery(const QSqlQuery &query);
QVariant data(const QModelIndex &index, int role) const;
Q_INVOKABLE QVariant datasingle(const QString &role) const;Q_INVOKABLE bool openDB(); Q_INVOKABLE void generateRoleNames(); Q_INVOKABLE void closeDB(); Q_INVOKABLE bool insertNotes(const QString &title, const QString &category, const QString ¬e, const QString &modified, const QString &modifiedlocale); Q_INVOKABLE bool updateNotes(const QString &title, const QString &category, const QString ¬e, const QString &modified, const QString &modifiedlocale, const int ¬eid); QSqlDatabase mydb;
signals:
public slots:
};@
customer.cpp
@Customer::Customer(QObject *parent) :
QObject(parent)
{}@
main.cpp
@
#include <QApplication>
#include <QQmlApplicationEngine>
#include "customer.h"int main(int argc, char *argv[])
{
QApplication app(argc, argv);qmlRegisterType <Customer> ("Customer", 1,0, "Customer"); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); return app.exec();
}
@CustomerList.qml
@
import QtQuick 2.1
import QtQuick.Controls 1.1import Customer 1.0
Rectangle{ width: 640 height: 480 color: "#212126" Customer { id: customer } Component.onCompleted: { customer.openDB(); }
@
Anyone has any idea about the error?
Thanks in advance