I have an application on which I show configuration panel (QFrame) to setup the configuration. Now I want to implement functionality where I close the configuration panel if the user clicks anywhere else on my application, but if the user clicks anywhere outside the application, it should not close the application.

Currently I have the following code which works fine on Win 7 but has issues on Mac.

Qt Code:
  1. void ConfigurationPanel::changeEvent ( QEvent * event)
  2. {
  3. if(event->type() == QEvent::ActivationChange)
  4. {
  5. if(!isActiveWindow())
  6. {
  7. if(QApplication::activeWindow())
  8. {
  9. close();
  10. }
  11. }
  12. }
  13. }
To copy to clipboard, switch view to plain text mode 
On windows QApplication::activeWindows() returns non-zero value if we click anywhere on the application (but outside configuration panel) and zero value if I click on any other application which is what is expected. But on Mac I always get zero value from QApplication::activeWindow() no matter where I click.

Can anyone tell me how can I fix this issue?

Thanks