Reputation: 16695
In a standard case people have an opportunity to create qml-plugins with C++. It is very easy, however whole internet have nothing about creating qml-components. I mean not really "creating" a component but making it able to package and deploy, something like "qmake; make; make install" algorithm which will look for qmldir file and add to "install" a copy action of qml-components described there.
In case of C++-plugin I am able to create a makefile which will install anything in the right places (shared library and qmldir). I need this for qml files but for qml files we have no any Makefile.
Back to reality, I've made my own qml-control. I want to package it into a deb file and upload it to my ppa, after that I wanna use it as dependency in another projects. What steps should I follow in order to create what I've said above here?
Control.qml
import QtQuick 2.2
Rectangle {
width:20
height:20
}
qmldir
module my.controls
Control 1.0 Control.qml
plugin mycontrols
Upvotes: 2
Views: 347
Reputation: 16695
However your solution is solution too and I might be using it soon I still want to answer my own question.
Suppose we have own qml-components and qmldir
file. In this case we need to do everything manually, but we can create .pro
file which always know (by qmake) where to install your stuff. So, pro
file must look like this:
TEMPLATE = lib
uri = my.controls
# Input
OTHER_FILES = qmldir \
Control.qml
qmldir.files = $$OTHER_FILES
unix {
installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)
qmldir.path = $$installPath
INSTALLS += qmldir
}
Upvotes: 0
Reputation: 53173
You just follow the same install procedure except that you install the components into a path where they will be recognized when they are imported. See the import path list in the engine.
By default, the list contains the directory of the application executable, paths specified in the QML2_IMPORT_PATH environment variable, and the builtin Qml2ImportsPath from QLibraryInfo.
Upvotes: 3