I make of with the following that seems to work fine for me:

Qt Code:
  1. bool isGuiApp()
  2. {
  3. bool aIsGuiApp = false;
  4. QApplication* aApplication = qobject_cast<QApplication*>(QCoreApplication::instance());
  5. if (aApplication)
  6. {
  7. aIsGuiApp = (aApplication->type() == QApplication::GuiClient);
  8. }
  9.  
  10. return aIsGuiApp;
  11. }
To copy to clipboard, switch view to plain text mode