Question

I am working in one BB10 Cascades app, QML and C++, i want to run one scheduled task in background thread, when user minimized the app(show only thumnail in desktop now, but not quit the app). How can know the app is running in background now? I have found this event handler:

https://developer.blackberry.com/cascades/reference/libbb/application_thumbnail.cpp.html

The sample code looks right, but i can not implement this into main.cpp of my project. main.cpp can not be treated as Object.

Anyone has right solution?

Thank you all!

Était-ce utile?

La solution

In your main method you will create an instance of Application and an instance of one of your own classes. You just hook up a slot in your class to the thumbnail() signal of the Application class, as shown in the example you linked to:

int main(int argc, char **argv) {
    bb::Application app(argc, argv);
    TestObject testObject;

    QObject::connect(&app, SIGNAL( thumbnail() ), &testObject, SLOT( onThumbnail() ));

    return app.exec();
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top