Skip to content

Commit 23aef2f

Browse files
committed
Use standard method for closing QApp when last window is closed.
setQuitOnLastWindowClosed(True) should be equivalent to lastWindowClosed.connect(quit), but is more introspectable (e.g. third-parties can check the value of quitOnLastWindowClosed()). AFAICT the code used lastWindowClosed.connect(quit) because it dates back to Qt3, where setQuitOnLastWindowClosed did not exist yet.
1 parent 852f121 commit 23aef2f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/backends/backend_qt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def _create_qApp():
140140
image = str(cbook._get_data_path('images/matplotlib.svg'))
141141
icon = QtGui.QIcon(image)
142142
app.setWindowIcon(icon)
143-
app.lastWindowClosed.connect(app.quit)
143+
app.setQuitOnLastWindowClosed(True)
144144
cbook._setup_new_guiapp()
145145
if qt_version == 5:
146146
app.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps)

0 commit comments

Comments
 (0)