Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have made a module to execute a shell script from within QML. The problem that I'm having is that I don't know how to import the module into my QML script. This is for a UT application BTW.

share|improve this question

1 Answer 1

This page from the Qt tutorials gives a good description of how to write a QML plugin in C++. I won't repeat all the details, but the basic idea is that you need to make a new class, inheriting from QQmlExtensionPlugin, to represent the plugin. It must have a registerTypes method, in which qmlRegisterType is called on each class to be exposed to QML. Additionally, a qmldir file must be added to the directory containing the .so files. (Or it can be put in another directory, but include the location of the .so files in the plugin line.)

I just got done learning this myself, and I've written up what I've learned, if that's any help.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.