Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Error in runtime module "Customer" is not installed

Error in runtime module "Customer" is not installed

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 563 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    algogr
    wrote on last edited by
    #1

    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_OBJECT

    public:
    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 &note, const QString &modified, const QString &modifiedlocale);
    Q_INVOKABLE bool updateNotes(const QString &title, const QString &category, const QString &note, const QString &modified, const QString &modifiedlocale, const int &noteid);
    
    
    
    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.1

    import 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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved