Quote Originally Posted by ChrisW67 View Post
I suspect QApplication::topLevelWidgets() should be non-empty for a GUI app.
You can have a perfectly good GUI application without any windows being open. I'd go for type(). On X11 you could check if you have a Display structure available.