R
R
Roma M2015-07-30 14:39:01
Programming
Roma M, 2015-07-30 14:39:01

How to build a plugin for QML?

Good day :)
I am writing custom components for QML. I'm trying to do this through plugins, so that I can then connect these elements in different projects using import. So, I tried to follow this example from the official site, but when I start the program, the QML debugger writes that my module or plugin is not installed. I understand that I did not clearly describe the problem. Do you have any direct advice or suggest where to look?
plugin .pro file:

TEMPLATE = lib
TARGET = LineChart
QT += qml quick
CONFIG += qt plugin

DESTDIR = C:\Qt\QtProjects\TestControls\dasr.antl.components
TARGET = $$qtLibraryTarget($$TARGET)
uri = dasr.antl.components

# Input
SOURCES += \
    linechart_plugin.cpp \
    linechart.cpp

HEADERS += \
    linechart_plugin.h \
    linechart.h

DISTFILES = qmldir

DESTPATH = C:\Qt\QtProjects\TestControls\dasr.antl.components

target.path=$$DESTPATH
qmldir.files=$$PWD/qmldir
qmldir.path=$$DESTPATH
INSTALLS += target qmldir

OTHER_FILES += qmldir

# Copy the qmldir file to the same folder as the plugin binary
QMAKE_POST_LINK += $$QMAKE_COPY $$replace($$list($$quote($$PWD/qmldir) $$DESTDIR), /, $$QMAKE_DIR_SEP)

QtQuick project .pro file
TARGET = TestControls
QT += qml quick



SOURCES += main.cpp

RESOURCES += qml.qrc

win32: DESTDIR = ./

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel K, 2015-08-01
@PavelK

I wrote for myself and for a long time, but suddenly it will work or suggest an idea:
pavelk.ru/pishem-rasshirenie-plugin-dlya-qml-qml-grid

R
Roman Isaikin, 2016-01-16
@romixlab

The plugin must be in a folder named Foo, the folder itself is either next to the executable or in Qt/xx/gcc_64/qml/. In the qmldir file:
module Foo
plugin foo
And next to it libfoo.so(.dll)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question