Strange resize behaviour for qt backend


I am using matplotlib for some data vizualization. To ensure a
consistent user interface among the whole application, I do the
scrolling/zooming stuff myself. So, for a diagram, a horizontal
scrollbar is displayed below the diagram that enabled to shift along the
x axis. This is (part of) the code:

from PyQt4 import QtGui, QtCore
from matplotlib.figure import Figure,SubplotParams

class DiagramWidget(QtGui.QWidget):
    def __init__(self, parent):
        QtGui.QWidget.__init__(self, parent)
        layout = QtGui.QVBoxLayout(self)
        self.diagram = InnerDiagramWidget(self)
        self.scrollbar = QtGui.QScrollBar(QtCore.Qt.Horizontal, self)
        self.connect(self.scrollbar, QtCore.SIGNAL('valueChanged(int)'),
# ...

class InnerDiagramWidget(FigureCanvas):
    def __init__(self, parent):
        fig = Figure(facecolor = 'w',
                     subplotpars = SubplotParams(left = 0.08, right=0.96,
                                                 bottom = 0.1, top=0.98))
        self.axes = fig.add_subplot(111)
        FigureCanvas.__init__(self, fig)
        FigureCanvas.setParent(self, parent)

    def scroll_event(self, x):
        pass # here is real code ofcourse
# ...

However, when I put this DiagramWidget into a window and try to resize
it vertically by mouse (with some data ... about 4000 points), the
scrollbar is not alwas shown correctly.

One can see that the diagram widget size does not change with every mouse
move, and the scrollbar sometimes goes out of the visible window, where
it is unusable.

The similar occurres in the horizontal direction: sometimes the
scrollbar gets not updated properly. This is the case when the Figure
canvas takes a long time for update.

If I put the scrollbar on top of the widget, everything is fine, except
that is the wrong place for a scrollbar :slight_smile:

Is this a bug in FigureCanvas, in Qt or in my code? How can I debug and
solve this?

Best regards