找不到QML模块

时间:2018-10-29 16:25:39

标签: qt qml qt-creator

我将一个项目复制到另一个目录(分叉了),现在我总是得到QML module not found (QtQuick.Controls).,类似。

原始项目没有显示任何错误。我清理并重建了所有东西,但没有解决。该项目可以编译并完美运行,因此QtCreator愚蠢地认为存在一些问题。

这可能是什么原因?我正在使用Qt 5.11,QtCreator 4.7.1

查看所附图片

enter image description here

项目文件:

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

1 个答案:

答案 0 :(得分:0)

我也遇到了这个问题,并且能够解决它,主要是按照警告消息中的说明进行操作。该警告消息的大致含义是:“请将/usr/lib64/qt/qml添加到您的QML_IMPORT_PATH变量中。”

在我的项目中进行的快速搜索在项目的.pro文件中仅发现QML_IMPORT_PATH的一个实例。我将建议的路径添加到.pro文件中的该行,问题已解决。

YMMV