Resize error with Qt4 backend

Hi all,

I’m having a problem with resizing a FigureCanvas using the Qt4 backend when the FigureCanvas is used alongside some dock widgets. What happens is that the figure never grows beyond the original size set when the window or other dock widgets are expanded. It’s probably easier to look at a screenshot taken after I resized (grew) things a bit:

http://brianz.s3.amazonaws.com/mpl_buggy.png

The simple code I used to generate and test this is located here:

http://brianz.s3.amazonaws.com/mpl_qt_buggy.py.txt

To get the FigureCanvas to resize at all, I’m passing the resizeEvent from the parent widget down to the FigureCanvas’s resizeEvent.

Am I doing something incorrectly here or is this a bug?

Thanks,
BZ

As usual, I ended up figuring this out after I sent this question.

The trick was adding the central widget (FigureCanvas) to a QLayout, and just ignoring the resizeEvent. So, I just did:

vbox = QVBoxLayout()
vbox.addWidget(self.canvas)
self.setLayout(vbox)

in the custom QWidget which holds the canvas and everything worked fine. I also removed the overridden resizeEvent.

BZ

···

On Wed, Jul 1, 2009 at 1:17 PM, Brian Zambrano <brianz@…287…> wrote:

Hi all,

I’m having a problem with resizing a FigureCanvas using the Qt4 backend when the FigureCanvas is used alongside some dock widgets. What happens is that the figure never grows beyond the original size set when the window or other dock widgets are expanded. It’s probably easier to look at a screenshot taken after I resized (grew) things a bit:

http://brianz.s3.amazonaws.com/mpl_buggy.png

The simple code I used to generate and test this is located here:

http://brianz.s3.amazonaws.com/mpl_qt_buggy.py.txt

To get the FigureCanvas to resize at all, I’m passing the resizeEvent from the parent widget down to the FigureCanvas’s resizeEvent.

Am I doing something incorrectly here or is this a bug?

Thanks,

BZ