First of all, you need to read this , fortunately, I recently developed ubuntu applications for HTML5, so I was in your place earlier, you can integrate your C ++ code using the QML option (since ubuntu developers have only 2 options: HTML5 or QML).
Here is an example project found on xda to create a simple calculator application (note how to include your cpp file):
File Name: apcalc-qml.pro
QT += qml quick
File name: main.cpp
#include <QtGui/QGuiApplication>
File name: main.qml
import QtQuick 2.0 import Ubuntu.Components 0.1 import "basicCalc" import QtQuick.Window 2.0 MainView { //objectName for functional testing purposes (autopilot-qt5) objectName: "mainView" applicationName: "apcalc-qml" automaticOrientation:true; width: units.gu(60); height: units.gu(100); id:root Tabs { objectName: "Tabs" ItemStyle.class: "new-tabs" anchors.fill: parent id:mainWindow; Tab { objectName: "Calculator" title: "Calculator" page:BasicCalc{ width: root.width; height: root.height-root.header.height; anchors.top: parent.top; anchors.topMargin: root.header.height; onToCalculateChanged: { //access to the c++ Object result=applicationData.calculate(toCalculate); } } } } }
File Name: applicationdata.h
#ifndef APPLICATIONDATA_H #define APPLICATIONDATA_H #include <QObject> class ApplicationData : public QObject { Q_OBJECT public: explicit ApplicationData(QObject *parent = 0); Q_INVOKABLE QString calculate(QString) const; signals: public slots: }; #endif // APPLICATIONDATA_H
File Name: applicationdata.cpp
#include "applicationdata.h" ApplicationData::ApplicationData(QObject *parent) : QObject(parent) { } QString ApplicationData::calculate(QString command) const { // Some Logic comes here return command; }
You can check out the full tutorial here , although this application is designed to work with ubuntu touch, but I believe that all QML projects follow the same procedure.
Publish app:
First of all, click โApplicationโ , this means that the package, one file will click> installs your application AKA (Personal Pack Archives (PPA)) to publish your application, you need to follow some procedure in detail here , while the xda tutorial explains everything clearly.
Prollygeek
source share