ipython/ipython — pull request #933 by jenshnielsen (2011-10-26 16:59:24+00:00)
Title: Cancel in qt console closeevent should trigger event.ignore()

When quitting ipython using for example the file quit option ipython quits even if you press cancel.
This pull request fixes that by inserting event.ignore() in the code the runs when cancel is pressed
and indenting the event.accept() so that it is only triggered when the yes button is pressed.

From the qt documentation and tutorials that I could find this seems to be the right way of using closeevent.