未找到 QML 模块

Nul*_*lik 5 qt qt-creator qml

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

原始项目没有显示任何错误。我清理并重建了所有东西,但这并没有解决它。该项目编译并完美运行,所以QtCreator不知何故被愚弄,认为存在一些问题。

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

见附图

在此处输入图片说明

项目文件:

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
Run Code Online (Sandbox Code Playgroud)

alp*_*tis 0

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

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

青年MMV