我正在努力使用qml模块:https://github.com/jwintz/qchart.js .
-
我把文件放在$ PROJECT / qmlModules / jbQuick / Charts / *中 .
-
已将.2818432_添加到.pro文件中 .
QML_IMPORT_PATH = ./qmlModules
- 现在我正在尝试导入jbQuick.Charts 1.0,
但QtCreator显示错误:找不到模块
Update
在干净的构建和重新运行qmake之后,错误编辑器消失了,但在运行时我得到:
qrc:/anzerzer.qml:7模块“jbQuick.Charts”未安装
Update 正如评论中所提到的,我已经为main.cpp添加了导入路径:
engine.addImportPath(QStringLiteral(“qmlModules”));
但错误仍然存在 .
禁用阴影构建可以解决问题 . 看起来我错过了部署步骤(qml模块文件的副本)
CONFIG += c++11 qml_debug
TEMPLATE = app
QT += qml quick widgets webkit webkitwidgets
HEADERS += VKApi.h \
VKResponse.h \
VKRequest.h \
VKRequestManager.h \
VKProfileAnalyzer.h \
VKGroup.h \
VKDayStats.h
SOURCES += main.cpp \
VKApi.cpp \
VKResponse.cpp \
VKRequest.cpp \
VKRequestManager.cpp \
VKProfileAnalyzer.cpp \
VKGroup.cpp \
VKDayStats.cpp
RESOURCES += qml.qrc
QML_IMPORT_TRACE = 1
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH += ./qmlModules
QML2_IMPORT_PATH += ./qmlModules
# Default rules for deployment.
include(deployment.pri)
1 回答
感谢您的所有意见 .
总结本地安装QML模块所需的所有步骤(在项目目录中):
QQmlApplicationEngine引擎;
engine.addImportPath(QStringLiteral( “qmlModules”));
engine.load(QUrl(QStringLiteral( “QRC:/analyzer.qml”)));
return app.exec();
}