I'm currently trying to make it possible for user to put few curves on the same plot. If it's going to be useful in any way I need to have multiple Y scales, so I can rescale every curve separately and give it it's own Y scale (X is time, so it's common for every sample). Unfortunately Qwt supports only 2 Y scales on default. I tried to cheat a little and it worked, but I'm not eager to trust this method.

Qt Code:
  1. QwtScaleWidget* scale2 = new QwtScaleWidget();
  2. scale2->setAlignment(QwtScaleDraw::RightScale);
  3. QwtScaleWidget* scale3 = new QwtScaleWidget();
  4. scale->setBorderDist(6,33); // I really think it's a bad idea
  5. scale2->setBorderDist(6,33);
  6. scale3->setBorderDist(6,33);
  7.  
  8. ui->leftLayout->addWidget(scale,0,0,1,1,0);
  9. ui->rightLayout->addWidget(scale2,0,0,1,1,0);
  10. ui->leftLayout->addWidget(scale3,0,1,1,1,0);
To copy to clipboard, switch view to plain text mode 

I did what you see above. Plot widget has two grid layouts on it's left and right, and I just put these scales inside. X axis is common and I use default one from QwtPlot (so I don't have to fit another one). Unfortunately these scales are not willing to be perfectly adjusted to plot just like that, so I needed to add setBorderDist. It's now perfectly fitted using trial and error method, and it SEEMS to work for all resolutions, but I don't think it will fit all the time in every case.

May I know if there is a better and less risky way to achieve that?

Also adding widgets to layout is pretty painful, because I can only add scale to the right of previous scale. So it's working well on the right side when user clicks "show me another plot" checkbox, and it does not work well on the left, so I would have to clean leftLayot from all widgets and add them again from a scratch in correct order. It has to work in real-time (showing new plots, hiding others and so on), so I can't really do it using designer.