I'm trying to display multiple plots in a column, which all have the same x-scale. However they have different data and different y-scales. This causes the yLeft axis widget to be different sizes, so the plots no longer line up.

To make them line up, I decided to pull out the individual widgets and put them in my own QGridLayout, as follows:
Qt Code:
  1. plotLayout->addWidget(plot->axisWidget(QwtPlot::yLeft), row, 0);
  2. plotLayout->addWidget(plot->canvas(), row, 1);
To copy to clipboard, switch view to plain text mode 
where plot is a QwtPlot, and plotLayout is a QGridLayout.

When I do this, I get a segfault somewhere in QwtPlotCanvas::drawContents().

My questions are:
  • Should this work, and I'm doing something somewhere else which screws up the canvas?
  • Is pulling the widgets out like this a bad thing to do, but there's another way to get my desired result?


Thanks,
-Joel