On Mac I need to set qApp->setQuitOnLastWindowClose(false) to achive correct behavior for closing windows. But how to detect, if the user clicks again on the active application icon in the dock? Or is there any other way to achieve native application quit and close behavior for OSX?