Do not connect KStandardAction::quit() to QApplication::quit()
aurelien.gateau at free.fr
Wed Jan 30 23:50:43 GMT 2008
David Faure wrote:
> 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
> usability.kde.org 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())".
Hum, I see. I guess I got used to Option+Q on Mac OS X being used to
*really* quit the whole application. Whether it's the behavior users will
expect should be debated on kde-usability. Will post a message about it.
More information about the kde-core-devel