Alright, I found the reason. QWidget::create() clears the Qt::WA_QuitOnClose attribute for anything but Qt::Window, Qt::Widget or Qt::Dialog. The workaround is to call for example QWidget::show() first, and set the attribute by hand afterwards:
Qt Code:
Switch view
#include <QtGui>
intmain ( intargc, char *argv [ ] )
{
app (argc, argv );
win ( 0, Qt :: Tool );
win. show ( ); // must be called before setting Qt::WA_QuitOnClose
win. setAttribute (Qt :: WA_QuitOnClose );
returnapp. exec ( );
}