← Back to team overview

ubuntu-phone team mailing list archive

Re: Fwd: [Development] Initialisation before run QCoreApplication

 

The documentation I linked to has an example:
https://doc.qt.io/qt-5/qqmlapplicationengine.html#details

On Wed, Feb 24, 2016 at 11:36 PM, Petr Štětka <stetka.peta@xxxxxxxxx> wrote:
> Can I find somewhere an example?
>
> 2016-02-24 10:37 GMT+01:00 Olivier Tilloy <olivier.tilloy@xxxxxxxxxxxxx>:
>>
>> 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
>
>
>
>
> --
> Mailing list: https://launchpad.net/~ubuntu-phone
> Post to     : ubuntu-phone@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~ubuntu-phone
> More help   : https://help.launchpad.net/ListHelp
>


References