[Qt-interest] Problem with aboutToClose signal
Arnold Krille
arnold at arnoldarts.de
Tue Jan 19 14:01:04 CET 2010
On Tuesday 19 January 2010 13:44:28 Mirko Viviani wrote:
> Hi list!
> I have a problem connecting the aboutToClose signal in my Windows core
> application.
> When hit the "X" button (close button) the slot myownclose is never
> executed (nor the aboutToClose signal emitted).
>
> Thanks to everybody!
>
> Here the (simplified) code:
>
> Class myHandler : QCoreApplication
> { ....
> /*construtcor */
> myHandler(int *argc, char* argv[]) : QCoreApplication(argc, argv)
> {
> ....
> connect (this, SIGNAL(aboutToClose()), this, SLOT(myownclose());
> }
> /*slot*/
> void myownclose()
> {
> do something
> }
>
> the main:
> int main(int argc, char *argv[])
>
> {
> myHandler mywindow(argc, argv);
>
> mywindow server.exec();
>
> }
>
Probably your app is complaining at runtime that there is no aboutToClose
signal with QCoreApplication. You mean aboutToQuit().
If your app has windows (widgets), you shouldn't use plain QCoreApplication.
If you are writing a console-app, hitting the 'X' symbol in the windows
terminal will _not_ make you app quit, but it will kill your app directly. No
aboutToQuit will be executed afaik.
Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100119/3a631eff/attachment.bin
More information about the Qt-interest-old
mailing list