Hi,

Is there a way to maintain QwtPlot's physical aspect ratio in a layout? Uwe, you suggested QwtPlotRescaler before, but now I need QwtPlot to look like a square widget instead of rectangle when the window stretches. Here's what I tried to do:

Qt Code:
  1. TargetDisplay::TargetDisplay(QWidget *parent)
  2. : QMainWindow(parent)
  3. {
  4. ui.setupUi(this);
  5. d_plot = new RandomPlot(this);
  6.  
  7. QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Preferred);
  8. policy.setHeightForWidth(true);
  9. d_plot->setSizePolicy(policy);
  10.  
  11. ui.horizontalLayout->insertWidget(0, d_plot);
  12. }
To copy to clipboard, switch view to plain text mode 

and then in my RandomPlot widget I have:

Qt Code:
  1. class RandomPlot: public IncrementalPlot
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. RandomPlot(QWidget *parent);
  7. ~RandomPlot();
  8.  
  9. int heightForWidth(int w) const {
  10. return w;
  11. }
  12. }
To copy to clipboard, switch view to plain text mode 

But it's not remaining a square whenever the window stretches. What else do I need to include? Thank you.

-James