创建Qml扩展插件

时间:2019-05-09 11:00:17

标签: plugins qml

我无法创建qml扩展插件并无法导入qml应用程序

Hallo I',试图建立一个qml插件, 我创建了一个QtQuick2 Extension PLugin,一旦构建,我得到了plugin.dll。 因此,我尝试生成qmltypes:我将qmldir文件放在dll的同一目录中,并给出以下命令:

qmlplugindump.exe -nonrelocatable -v oboComponents 1.0 C:/Users/Diego/Documents/build-NetTcpConnection-Desktop_Qt_5_12_2_MinGW_64_bit2-Release/oboComponents C:/Users/Diego/Documents/build-NetTcpConnection-Desktop_Qt_5_12_2_MinGW_64_bit2-Release/oboComponents/plugins.qmltypes

但是我遇到了以下错误:

位置参数个数不正确

这是我的.pro文件:

TEMPLATE = lib
TARGET = NetTcpConn
QT += qml quick
CONFIG += plugin c++11

TARGET = $$qtLibraryTarget($$TARGET)
uri = Oboqmlcomponents

# Input
SOURCES +=         nettcpconn_plugin.cpp         nettcp.cpp

HEADERS +=         nettcpconn_plugin.h         nettcp.h

DISTFILES = qmldir

!equals(_PRO_FILE_PWD_, $$OUT_PWD) {
    copy_qmldir.target = $$OUT_PWD/qmldir
    copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir
    copy_qmldir.commands = $(COPY_FILE) "$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)" "$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)"
    QMAKE_EXTRA_TARGETS += copy_qmldir
    PRE_TARGETDEPS += $$copy_qmldir.target
}

qmldir.files = qmldir
unix {
    installPath = $$[QT_INSTALL_QML]/$$replace(uri, \., /)
    qmldir.path = $$installPath
    target.path = $$installPath
    INSTALLS += target qmldir
}

这是qmldir文件:

module oboComponents
plugin NetTcpConnection

如果尝试在项目中导入插件,则不会加载该插件。 我读了很多文档,但无法解决问题。

0 个答案:

没有答案