Nulik
Nulik

Reputation: 7380

QML module not found

I copied a project to another directory (forked it) and now I always get QML module not found (QtQuick.Controls). , and similar.

The original project does not show any errors. I cleaned and rebuilt everything but that didn't solve it. The project compiles and runs perfectly, so QtCreator is somehow fooled that there is some problem.

What could be the reason for this? I am using Qt 5.11, QtCreator 4.7.1

See attached picture

enter image description here

Project file:

QT += quick network
QT += quickcontrols2
QT += widgets
CONFIG += c++11

# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
    blockchainaccount.cpp \
    blockies.cpp \
    error.cpp \
    ethkey.cpp \
    hqx.cpp \
    hqx2.cpp \
    hqx3.cpp \
    hqx4.cpp \
    identicon.cpp \
    walletaccount.cpp \
    main.cpp \
    aewm.cpp \
    acctlist.cpp \
    block.cpp \
    blocklist.cpp \
    txlist.cpp \
    vtlist.cpp \
    transaction.cpp \
    valuetransfer.cpp \
    acctcatlist.cpp \
    ftokens.cpp \
    token.cpp \
    txparam.cpp \
    ftokops.cpp \
    nftokens.cpp \
    simres.cpp \
    ftapprovals.cpp \
    ftholders.cpp \
    mainstats.cpp \
    prefs.cpp \
    blockheader.cpp \
    addresslist.cpp \
    acctcat.cpp \
    balance.cpp \
    big.cpp \
    tokop.cpp \
    ftholder.cpp \
    ftapproval.cpp \
    utils.cpp

RESOURCES += qml.qrc

# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =

# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =


# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

DISTFILES +=

HEADERS += \
    blockchainaccount.h \
    blockies.h \
    error.h \
    ethkey.h \
    hqx.h \
    hqx2.h \
    hqx3.h \
    hqx4.h \
    identicon.h \
    walletaccount.h \
    aewm.h \
    acctlist.h \
    block.h \
    blocklist.h \
    txlist.h \
    vtlist.h \
    transaction.h \
    valuetransfer.h \
    acctcatlist.h \
    ftokens.h \
    token.h \
    txparam.h \
    ftokops.h \
    nftokens.h \
    simres.h \
    ftapprovals.h \
    ftholders.h \
    mainstats.h \
    prefs.h \
    blockheader.h \
    addresslist.h \
    acctcat.h \
    balance.h \
    big.h \
    tokop.h \
    ftholder.h \
    ftapproval.h \
    utils.h \
    config.h

Upvotes: 5

Views: 6520

Answers (1)

alpartis
alpartis

Reputation: 1122

I too had this problem and was able to resolve it, mostly by just following the instructions in the warning message. A rough approximation of that warning message said, "please add /usr/lib64/qt/qml to your QML_IMPORT_PATH variable."

A quick search in my project found just one instance of QML_IMPORT_PATH in the project's .pro file. I added the suggested path to that line in the .pro file and the problem was resolved.

YMMV

Upvotes: 0

Related Questions