Problem quitting Qt-Quick application
-
Hi,
I have put on the screen a custom button to quit the application. To the onClicked event, I answer with
@{ Qt.quit(); debugMessage("QUIT APPLICATION") }@
The application stops correctly, but - in debug mode - the console shows the following message that I haven't clear how to manage:
@*** Debug main: QUIT APPLICATION
QCoreApplication::applicationFilePath: Please instantiate the QApplication object first
QEventLoop: Cannot be used without QApplication@(the *** Debug main ... message is a debug function similar to the console output, it's mine used to know that the event has really occoured)
Can someone tell me what I can do? Thanks.
-
Hi Volker. I was testing more the question.
Yes, output the debug message PLUS those couple of messages then quit. This doesn't happens with the release version nor other times I restart the application. I think that this was a "O.T." message of Qt environment, because as a matter of fact does not affect the application. So, I don't know what it is and I am a little worry ... If it's a silly question, amen :)
-
This is a good consideration, Volker. As a matter of fact, I don't save nothing, but the program does two periodical updates: every about five minutes updates a twitter feed, while every 10 seconds rotate a set of AD banners.
I thought this and blocked one of the two cases: when the program updates the twitter feeds, a short help overimpose the quit button so it can't be used while the program is not quiet. The only case that can occur generating problems (if this can impact on the system environment) is when the banner rotates (it is loaded by the web).
-
Do you have timers running for the two update jobs? If yes, you might consider stopping them before calling Qt.quit().
Searching the web, I stumbled over this Forum.Nokia post about "Closing a Qt Quick application from QML":http://wiki.forum.nokia.com/index.php/CS001626_-_Closing_a_Qt_Quick_application_from_QML
-
Thanks, Volker, I read this. I think that your advice can be a good idea. Thus to stop the timers before quitting is not so difficult, considering the point where the call is (all the control function are in the main.qml)
-
Tested in this moment. Works perfectly!
Without timer stopping, the application exit then wait a little before stopping and not all the times signals "exit application with 0"
With the timer stopping sequence, stop the timers, exits and signal the correct program completion immediately. More robust and reliable. This night 1.0 rc is out :=)