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.

Are there any c++ examples? New project>ubuntu> only allows simple qml apps.

There is much, much more to tablets than some fancy buttons and a few lines of java script! If c++ is deprecated, please say so. Thanks.

share|improve this question
    
Yes its disappointing to see that c++ is not occupying the place it should in the ubuntu mobile app development.Using a ubuntu phone my expectation would be to ssh my aws ec2 instance and being able to manage my servers from my phone ... Would have loved if c++(c family) would have been prominent in all MVC –  amar Nov 11 at 8:20

1 Answer 1

The Ubuntu App Developer page says:

We recommend using QML as the language of choice to write apps with the Ubuntu SDK.

However, if you need to write your app in C or C++, or want to build a lower level piece of technology such as a game engine, physics algorithm, or create hardware support for a device, Ubuntu provides everything you need to get started.

It's true that there are no tutorials (you may consider writing one eventually) for using C++ to write Ubuntu apps, but that same page has a nice set of links to C++ material.

You might also look at the links on the Qt 5.0 Documentation page and the Qt 5.0 Examples and Tutorials.

To create apps for touch devices, I believe that you need to create QML projects rather than desktop projects; but you can still call your C++ code from the QML app.

You can find some examples at the Qt Project. Look especially at the set of links under the C++ extensions section. Please note that these examples are specifically for Qt 4.8. Please also see Porting QML Applications to Qt 5

Also see Integrating QML and C++ in Qt 5.0.

Running Native Desktop Apps

As for problem of running a desktop app written in C++ with a QML GUI as opposed to calling C++ from QML, I think the problem you are running into is that Ubuntu Touch is an ongoing project and that many planned features are not yet implemented.

I believe the following information shows that what you want to do will be possible eventually, but that right now native C++ apps may need to run as console based.

From the Touch FAQ:

Ubuntu Touch is primarily designed to support web apps, and native apps programmed in qml and javascript or C++. As it is a real linux, of course all non graphical applications run equally as on any other linux system. You can ssh to Ubuntu Touch and run any console based application.

X11 is not supported (so far) so all GUI standard applications will not run.

Ubuntu Touch is a real linux, of course you can install a c compiler and all the rest of the essential-build system and can develop on the mobile devices like on any other linux.

From the XDA Developers FAQ:

Yes, native apps can be written in C++/Qt, or QML/Javascript. We provide a UI Toolkit with native widgets that you can use in your apps.

The desktop shell (Unity 7) will be re-implemented in the same codebase as Ubuntu Touch (Unity 8), so that there will be one "Unity" that can change the way it looks and behaves depending on the kind of device it is running on. For app developers, the platform will be the same, the APIs will be the same, they won't need to maintain separate versions of their app.

You can also view the status of features in the Ubuntu SDK. Most features are still In Progress or TODO

share|improve this answer
    
Thanks. I already have several of C++<>QML applications working with Qt on desktop and Sailfish, but I cannot 'connect' to ubuntu. As far as I can see, only project under Ubuntu can be deployed on an ubuntu devices. picking a c++ project automatically becomes a desktop application. –  user166014 Jul 2 '13 at 19:04
    
I added some more links to examples and documentation based on your comment. If these don't answer your question, please edit your question to include more specifics on the problems you are having. :) –  chaskes Jul 2 '13 at 19:33
    
Thanks. I am trying to port a current application (runs on a netbook) that has a C++ core (timer, udev, file I/O, etc.) and has a QML GUI. The other way around (calling C++ from QML) would ruin the complete architecture. I am doing the same for Sailfish, but there I could start of from a little C++ main function. So, getting QML work with C++ isn't the problem, but I need a C++ main function. (BTW: QDeclarative has disappeared in Qt5). –  user166014 Jul 2 '13 at 20:37
    
I clarified the 4.8 vs 5.0 issues with the example pages by linking to the conversion page. Most of the 4.8 examples haven't been updated to 5.0 yet. As for the rest of the new info, I hope it answers your question. –  chaskes Jul 2 '13 at 21:20
1  
Thanks for the elaborate answer. I'll wait for the "Interacting with QML Objects from C++" implementation within the SDK. Still, I do want emphasize that the lack of this implementation will hold back many developers that have apps that are written in the common programming languages like C++ (IOS) and JAVA (Android). Very hard/impossible to replace by (light weighted) java script. –  user166014 Jul 3 '13 at 8:23

Your Answer

 
discard

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.