libbb/Application_manualExit.cpp

This example illustrates how to connect to the Application manualExit signal in C++.
#include <bb/Application>
#include <QObject>

class TestObject: public QObject {
Q_OBJECT
public Q_SLOTS:
    void onManualExit();
};

void TestObject::onManualExit() {
    // Handle exit explicitly.
    // Make sure to exit the application at the end.
}

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

    // The manualExit signal will not be emitted unless auto exit flag set to false.
    app.setAutoExit(false);

    QObject::connect(&app, SIGNAL( manualExit() ), &testObject, SLOT( onManualExit() ));

    return app.exec();
}

Overview

Last modified: 2014-03-13

comments powered by Disqus