Resizing bug in qt4 backend.

When resizing a figure using fig.set_size_inches, the Qt backend doesn’t take into account the height of the status bar or the toolbar.

For example, the following script plots two figures—both should be 1-inch square, but this is only true of the second figure.

···

#~~~~~
import matplotlib as mpl
mpl.use(‘qt4agg’)
import matplotlib.pyplot as plt

fig = plt.figure()
fig.set_size_inches(1, 1, forward=True)

plt.figure(figsize=(1, 1))

plt.show()
#~~~~~

Note that this bug doesn’t appear with savefig since that doesn’t need to account of toolbar/status bar heights.

I’ve submitted a PR for a fix, but I don’t know how general this is. For example, I couldn’t get the figure to redraw after changing the figure size with fig.set_figwidth or fig.set_figheight, so I couldn’t test for that.

Also, I noticed that ‘tkagg’ has problems with this example code, but I didn’t have time to look into that.

-Tony