← Back to team overview

ubuntu-phone team mailing list archive

Re: [Development] Initialisation before run QCoreApplication

 

On Wed, Feb 24, 2016 at 10:28 AM, Petr Štětka <stetka.peta@xxxxxxxxx> wrote:
> Hi guys I want do some initialisation before run app, because I must do it
> for some library. But I want use QML as in normal Ubuntu Touch app do it. I
> want create .click package too.
> So how can I do something like this?
>
> int main(int argc, char *argv[])
> {
>     QCoreApplication a(argc, argv);
>     some_initialisation();
>     return a.exec();
> }

You will need to instantiate a QQmlApplicationEngine¹ or a QQuickView²
in the main function, before calling exec() on your application.

There is some documentation on how to write and package a C++/QML app
at https://developer.ubuntu.com/en/apps/qml/tutorials/add-cpp-backend-your-qml-app/.

HTH,

 Olivier


¹ https://doc.qt.io/qt-5/qqmlapplicationengine.html
² https://doc.qt.io/qt-5/qquickview.html


References