Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QML module not found in Designer using QML_ELEMENT



  • Hello,

    I integrated C++ class into QML using QML_ELEMENT. While it compiles and works find, in Qt Designer, in QML file the import line with module name is highlighted and error appears: QML module not found (Backend).

    In .pro file I have the following:

    CONFIG += qmltypes
    
    QML_IMPORT_NAME = Backend
    QML_IMPORT_MAJOR_VERSION = 1
    

    In apimanager.h file I have the following:

    class ApiManager : public QObject
    {
        Q_OBJECT
    
        QML_ELEMENT
    
        const QString apiUrl = "https://127.0.0.1:8000/api/";
    
    public:
        explicit ApiManager(QObject *parent = nullptr);
    
        Q_INVOKABLE void login(QString username, QString password);
    

    I'm running Qt 5.15.1 on MacOS. While having the same version on my Laptop does not show this error, on my Desktop PC it does. I have tried to fully reinstall Qt (manually deleted all config and cache folders).


Log in to reply