2

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
4
  • I do not follow. You can install anything with qmake rules just as well as with raw make rules. What problem exactly are you facing? You may want to check out the harmattan components that I used to work on back then. That exactly did what you want. Commented Dec 6, 2014 at 19:14
  • So here is no any default algorithm for that? I mean I need to create a whole deb-package by myself with proper install script which will copy files I need, etc..? I am not worrying about it just asking is here any algorithm or people do this manually. Commented Dec 6, 2014 at 19:16
  • You never have any algorithm. You always write the build system for yourself for good, especially with raw makefiles. Why don't you even use qmake? I would be quite worried if something "intelligent" decides ruling me out where to install stuff. Commented Dec 6, 2014 at 19:19
  • I agree with you, but qmake always know where to install because of qtchooser I think. So I need to find out default qml_import_path and install files there. It looks I got everything I need, thank you. Commented Dec 6, 2014 at 19:22

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.