Yes. Connect the lastWindowClosed() signal of the application object to its quit() slot.