Do not connect KStandardAction::quit() to QApplication::quit()

David Faure faure at
Wed Jan 30 23:14:40 GMT 2008

On Wednesday 30 January 2008, David Faure wrote:
> On Thursday 06 December 2007, Aurélien Gâteau wrote:
> > Hello,
> > 
> > I just got bitten by this one, so I thought I'd share it with you.
> > 
> > If your application implements KMainWindow::queryClose() to warn the user
> > about unsaved changes for example, do not connect KStandardAction::quit()
> > to QApplication::quit() as it would bypass the queryClose(). Instead,
> > connect it to QApplication::closeAllWindows().
> > 
> > I had a look at my incomplete checkout of KDE and only find one mistake:
> > kapptemplate. Attached patch fix it. Ok to commit?
> Yes please do.

Ah! I remember now. Doh, what was I thinking.

The styleguide (in KDE 3 at least; the current styleguide on seems to have nothing about this) says:
"Closing the application by selecting Quit in the File-menu closes the document-window and the document within it. Closing the document-window by selecting the X on the window border is equivalent to selecting Quit in the File-menu. 
"Implementation Note
"   Please note that closing the application does not necessarily mean terminating the UNIX process - other application instances may be using the same UNIX process and they should remain unaffected!

This means that connecting to closeAllWindows() is just as wrong as connecting to quit().
In most KDE applications, the quit standardaction should be connected to "this, SLOT(close())".

No, I am not opening the debate on this kde3 styleguide feature here; if you wish to debate this,
take it to the usability list :).
(But in fact is a bit confusing about the current status of things; I assume
that "the version that has been the KDE styleguide for two major versions is still online and largely up to date"
refers to the above url, a direct link would have been quite helpful...)

David Faure, faure at, sponsored by Trolltech to work on KDE,
Konqueror (, and KOffice (

More information about the kde-core-devel mailing list