
Originally Posted by
Buffy
... how do I work the numbers backwards to determine the space required?
virtual QSize YourPlot
::sizeHint() const {
const int dim = 10000; // something large
plotLayout
()->activate
( this,
QRectF( 0,
0, dim, dim
) );
const int canvasWidth = ...; // this is the number of pixels you want to have for your canvas
int w = canvasWidth + dim - plotLayout()->canvasRect().width();
plotLayout()->invalidate();
}
virtual QSize YourPlot::sizeHint() const
{
const int dim = 10000; // something large
plotLayout()->activate( this, QRectF( 0, 0, dim, dim ) );
const int canvasWidth = ...; // this is the number of pixels you want to have for your canvas
int w = canvasWidth + dim - plotLayout()->canvasRect().width();
plotLayout()->invalidate();
return QSize( w, QwtPlot::sizeHint().height() );
}
To copy to clipboard, switch view to plain text mode
The idea is to calculate the layout with some large rectangle. As the canvas gets all the additional space you can easily calculate the fixed parts by subtracting the calculated canvas width. Then add the width you need.
Uwe
Bookmarks