Tools

Namespaces

Variants

Views

Actions

Search

Contents

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Contents

Overview

This snippet shows how to trigger the closing of a Qt Quick application from QML code. This is needed especially in full screen applications, because there may not be any dedicated hardware key to close the application.

The following QML code calls the global Qt.quit() function which will trigger the ending of the application. In this example, we have used QDeclarativeView to show the Qt Quick UI and thus we must connect the QDeclarativeEngine::quit() signal to the QApplication::quit() slot.

NOTE: Had we used qmlviewer to interpret the QML, the Qt.quit() signal would have been automatically handled.

Postconditions

The calling of the Qt.quit() function in QML code caused the emission of the QDeclarativeEngine::quit() signal, and because this signal was connected to the QApplication::quit() slot, the application was closed.