Skip to content

Commit 54655a3

Browse files
authored
Merge pull request #15618 from meeseeksmachine/auto-backport-of-pr-15613-on-v3.2.x
Backport PR #15613 on branch v3.2.x (Revert "Don't bother with manually resizing the Qt main window.")
2 parents c629a21 + 20db586 commit 54655a3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,16 @@ def __init__(self, canvas, num):
572572
statusbar_label = QtWidgets.QLabel()
573573
self.window.statusBar().addWidget(statusbar_label)
574574
self.toolbar.message.connect(statusbar_label.setText)
575+
tbs_height = self.toolbar.sizeHint().height()
576+
else:
577+
tbs_height = 0
578+
579+
# resize the main window so it will display the canvas with the
580+
# requested size:
581+
cs = canvas.sizeHint()
582+
sbs = self.window.statusBar().sizeHint()
583+
height = cs.height() + tbs_height + sbs.height()
584+
self.window.resize(cs.width(), height)
575585

576586
self.window.setCentralWidget(self.canvas)
577587

0 commit comments

Comments
 (0)