Merge pull request #1678 from tacaswell/qt4_closeevent

added QtGui.QMainWindow.closeEvent() to make sure the close event
Re-wired signal/slot connections so that the figure in removed from
Gcf when it is closed.

In PR #1498 the attribute WA_DeleteOnClose was no longer set on the
QtMainWindow object in QtFigureManager.  The signal connection that
was being used to remove the figure from Gcf when the window was closed
was tied to the `destroyed()` signal of QtMainWindow, which is no
longer being destroyed.  Thus, gca and gcf would return references
to no-longer visible figures/axes.  _widgetclosed is now called when
MainWindow emits 'closing()'.
PEP8: whitespaces
Add figure close test for qt4 backend
PEP8 fixes to FigureManagerQT class
test for issue #1683
fixed link rot
removed unused import
added knownfailureif to test based on if qt4_compat could be imported,
as this should hit either PySide or PyQt4, depending on which is
installed.  (I have faith that the setup code that will make sure that
if only one of them is installed, it defaults to using that one)
added test_backend_qt4 to test list
Merge pull request #1705 from tacaswell/qt_closeevent_v1.2

Qt closeevent fixes for  v1.2.x
Merge remote-tracking branch 'upstream/v1.2.x'

Conflicts:
	lib/matplotlib/backends/backend_qt4.py