diff options
author | Cavit Sina Dogru <sinadooru@gmail.com> | 2016-08-03 17:54:26 +0300 |
---|---|---|
committer | Cavit Sina Dogru <sinadooru@gmail.com> | 2016-08-09 17:16:44 +0000 |
commit | 4fbfbf7fe8e6f8f31b5704a0f8f55415a7284523 (patch) | |
tree | 71a71026465ea74e0e340d56e1121f0b2e99fad1 /src/qml/qml/qqmlengine.cpp | |
parent | 9e9bf93deaec24d69fa76d0218e0235fc404c6b2 (diff) |
Qt object: Add exit(int)
This is similar to the Qt.quit() function but also specifies the return
code that the event loop will return.
[ChangeLog][QtQml] Added exit(int retCode) method to the Qt global object.
An application can call Qt.exit to specify a return code of the engine.
Task-number: QTBUG-54360
Change-Id: Iaa319e6dc4d6b99dc3a5c01845e87b936fd2cab0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlengine.cpp')
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 2b49eae4de..cdaa9e83e9 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -982,8 +982,19 @@ QQmlEngine::~QQmlEngine() /*! \fn void QQmlEngine::quit() This signal is emitted when the QML loaded by the engine would like to quit. + + \sa exit() */ +/*! \fn void QQmlEngine::exit(int retCode) + This signal is emitted when the QML loaded by the engine would like to exit + from the event loop with the specified return code. + + \since 5.8 + \sa quit() + */ + + /*! \fn void QQmlEngine::warnings(const QList<QQmlError> &warnings) This signal is emitted when \a warnings messages are generated by QML. */ @@ -1837,6 +1848,14 @@ void QQmlEnginePrivate::sendQuit() } } +void QQmlEnginePrivate::sendExit(int retCode) +{ + Q_Q(QQmlEngine); + if (q->receivers(SIGNAL(exit(int))) == 0) + qWarning("Signal QQmlEngine::exit() emitted, but no receivers connected to handle it."); + emit q->exit(retCode); +} + static void dumpwarning(const QQmlError &error) { QMessageLogger(error.url().toString().toLatin1().constData(), |