yeah, that plotmatrix example also helped me alot,
i had the same problem with aligning my plots vertically (if that is the problem you have) and i solved it like this way
{
QListIterator<QwtPlot*> it(myPlots); //i have a QList<QwtPlot*> for my plots
int maxExtent = 0;
while (it.hasNext())
{
current_plot = it.next();
sd->setMinimumExtent(0);
const int extent = sd->extent(
QPen(Qt
::black, scaleWidget
->penWidth
()),
scaleWidget->font() );
if ( extent > maxExtent )
maxExtent = extent;
}
it.toFront();
while (it.hasNext())
{
current_plot = it.next();
scaleWidget->scaleDraw()->setMinimumExtent(maxExtent);
}
}
void myPlotFrame::paintEvent(QPaintEvent *pe)
{
QListIterator<QwtPlot*> it(myPlots); //i have a QList<QwtPlot*> for my plots
QwtPlot *current_plot;
int maxExtent = 0;
while (it.hasNext())
{
current_plot = it.next();
QwtScaleWidget *scaleWidget = current_plot->axisWidget(QwtPlot::yLeft);
QwtScaleDraw *sd = scaleWidget->scaleDraw();
sd->setMinimumExtent(0);
const int extent = sd->extent(
QPen(Qt::black, scaleWidget->penWidth()),
scaleWidget->font() );
if ( extent > maxExtent )
maxExtent = extent;
}
it.toFront();
while (it.hasNext())
{
current_plot = it.next();
QwtScaleWidget *scaleWidget = current_plot->axisWidget(QwtPlot::yLeft);
scaleWidget->scaleDraw()->setMinimumExtent(maxExtent);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks