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.

Recently, I want to develop a app for ubuntu showdown, but I want to use some plugins use c++. So I want to write custom plugins, then I create a project with qml extension library. However, when I run it, it just pops up a dialog.

I have no reputation to upload an image, if you can do it self, you will know what I say. I want to know whether I can use c++ in ubuntu touch apps, if I can, I want some examples.

Ps: I am new to qml and ubuntu sdk

share|improve this question

closed as unclear what you're asking by dobey, Braiam, Seth, guntbert, psusi Aug 30 '13 at 0:13

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Edit your question and add the code please. You can also upload the image to imgur.com and provide the link. –  Braiam Aug 23 '13 at 17:16
    
Currently, your question is a bit light on details. Tell us what plugins you intend to use, etc. You should edit your question and add as much specific details as much possible for us to be most helpful. You can upload the image to a image hosting website and link us to the image there. –  jokerdino Aug 26 '13 at 13:34

1 Answer 1

I just learned how to do this, and I wrote up what I learned here. I'll repeat the basic ideas here.

Whichever C++ classes you wish to expose can be left mostly as is. Any methods that you want exposed to QML need to be prefixed with Q_INVOKABLE in the header file. To represent the plugin, you need a class that inherits from QQmlExtensionPlugin which has a registerTypes method that calls qmlRegisterType on each class to be exposed to QML.

The dialog you mention, was it this?

Qt creator dialog

If so, then for "Command" put qmlscene and for "Arguments", -I <DIR> <QML>, where <DIR> is the directory containing the plugin directory (likely ., the project directory) and <QML> is your main .qml file. Again, see my post for a more thorough explanation and a downloadable example.

share|improve this answer

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