diff --git a/lib/matplotlib/backends/backend_qt5.py b/lib/matplotlib/backends/backend_qt5.py index 876eb36bafac..81a80b2f5195 100644 --- a/lib/matplotlib/backends/backend_qt5.py +++ b/lib/matplotlib/backends/backend_qt5.py @@ -474,18 +474,18 @@ def __init__(self, canvas, num): self.window._destroying = False + # add text label to status bar + self.statusbar_label = QtWidgets.QLabel() + self.window.statusBar().addWidget(self.statusbar_label) + self.toolbar = self._get_toolbar(self.canvas, self.window) if self.toolbar is not None: self.window.addToolBar(self.toolbar) - self.toolbar.message.connect(self._show_message) + self.toolbar.message.connect(self.statusbar_label.setText) tbs_height = self.toolbar.sizeHint().height() else: tbs_height = 0 - # add text label to status bar - self.statusbar_label = QtWidgets.QLabel() - self.window.statusBar().addWidget(self.statusbar_label) - # resize the main window so it will display the canvas with the # requested size: cs = canvas.sizeHint() @@ -507,10 +507,6 @@ def notify_axes_change(fig): self.canvas.figure.add_axobserver(notify_axes_change) self.window.raise_() - @QtCore.Slot() - def _show_message(self, s): - self.statusbar_label.setText(s) - def full_screen_toggle(self): if self.window.isFullScreen(): self.window.showNormal()