[Qt-interest] lastWindowClosed not emmited in qt4

Denton Vis vistapro7 at hotmail.com
Mon Mar 23 22:24:00 CET 2009


If you can't call the QApplication::exec() then you are out of luck because, 
to quote the documentation:

"void QApplication::lastWindowClosed ()   [signal]

This signal is emitted from QApplication::exec() when the last visible 
primary window (i.e. window with no parent) with the Qt::WA_QuitOnClose 
attribute set is closed...."

Also it is important for you to use the QApplication object (or its 
QCoreApplication counterpart for non-gui apps) as stated in the docs:
"Since the QApplication object does so much initialization, it must be 
created before any other objects related to the user interface are created."



"Bastiaan Naber" <bastiaannaber at gmail.com> wrote in message 
news:200903221832.49988.bastiaannaber at gmail.com...
> Hi,
>
> I've been trying to port my very basic Qt3 app to Qt4. In my app I can't 
> call
> the exec() function of QApplication. Instead I have a timer (not a Qt one)
> that calls processEvents() every 25ms. This worked fine in Qt3, however in
> Qt4 it seems to cause a bit more problems. First I get irregular 
> segfaults, I
> will try to look into this a bit more.
>
> Second, is that it seems that the lastWindowClosed signal isn't emmited
> anymore. In my Qt3 app I connected this signal to my custom exit routine 
> and
> I really need it.
>
> My app has multiple windows so I can't just use the closeEvent of the
> individual windows to abort.
>
> Is it correct that the lastWindowClosed signal isn't emmited? or is there 
> a
> bug in somewhere?
>
> I'm using the Qt version that came with Centos 5 (Qt 4.2).
>
> Thanks,
> Bastiaan 




More information about the Qt-interest-old mailing list