[Qt-interest] Hide rather than quit on close window event

André Somers andre at familiesomers.nl
Thu Oct 28 13:45:54 CEST 2010


On Thursday 28 October 2010 13:26:29 Aaron Lewis wrote:
> Hi,
> 	Was it possible to achieve this:
> 
> 	On specify key combinations like ^Q or ALT_F4 triggered , call hide() ,
> without re-implementation of closeEvent() ?
> 
> 	Tried a keyPressEvent with Qt::Key_Close , seems not very feasible ,
> anybody got a better idea ?
> 
> 	Thanks !

The default is to hide a window, but not destruct the class instance. However, 
the default is also that an application closes if the last window closes. You 
can alter that with flags. See Qt::WA_QuitOnClose and 
QApplication::quitOnLastWindowClosed

André




More information about the Qt-interest-old mailing list