title: Python Qtconsole: QApp = QCoreApplication.instance() returns None on Linux and a valid QApplication on Windows
body: <p>I have software which has a GUI interface and a command line interface. What it should do is detect if it is being run in a qtconsole. If it is, it will not create a new QApplication and show the GUI in a non-blocking manner. After the script exists, there will be a cmd object where the user can interact with things on a lower level. </p>
  
  <pre><code>from PyQt4.QtCore import QCoreApplication
  from PyQt4.Qt import QApplication
  import sys
  
  QApp = QCoreApplication.instance() 
  new_qapp_bit = False
  if QApp == None:
      print 'running without the qt console'
      new_qapp_bit = True
      QApp = QApplication(sys.argv)
  else:
      print 'found the qt console'
  
  cmd = MyCMDInterface(use_gui=True)
  
  if new_qapp_bit
      sys.exit(QApp.exec_())
  </code></pre>
  
  <p>On windows this works perfectly, QCoreApplication.instance() returns a valid QApplication and everything goes according to plan, but on Linux and Mac it returns None. I've been hacking at this awhile, and I'm not seeing any answers. </p>