Ubuntu – ubuntu sdk has no c++ examples


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.

Best Answer

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