Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] purpose of qApp
on my "last post":http://developer.qt.nokia.com/forums/viewthread/4524, i look on how to print documents and on the middle of tracing the code sample. i came across a qApp and it bugs me cause i dont know how and what is its use. it is in the constructor and the printDocument function of the cpp file of the Font Sampler.
can anyone or anybody tell me what is it?
[EDIT: fixed link, Volker]
ok. i get it now but i have another question.
how does qApp detect the name of the "Cancel" button when the progress dialog appear?
in the constructor, there is a connect() to cancel the process. how does the Font Sampler knew that the "quitAction" is the name of the "Cancel" button?
I assume you're talking about the mainwindow.cpp file in the fontsampler demo (some detail in your question would help.)
You're mixing up a couple of things. The connect (at line 58) doesn't have anything to do with canceling the progress dialog. quitAction's triggered() slot is connected to the QApplication::quit() slot, which exits the application. quitAction is defined in mainwindowbase.ui. It knows about that connection because of the connect.
The cancellation of the progress dialog is handled down at line 293, where the status of the progress dialog is specifically checked to see if it was canceled.