Well QwtPlot::updateLayout() is about adjusting the content to a given geometry, not about changing the geometry. So the posted implementation will never work !
Better try something like this:
{
public:
virtual void activate
( const QwtPlot *plot,
const QRectF &rect, Options options
) {
const QRectF rect
= adjustedRect
( plot, rect
);
}
};
class YourPlotLayout: public QwtPlotLayout
{
public:
virtual void activate( const QwtPlot *plot,
const QRectF &rect, Options options )
{
const QRectF rect = adjustedRect( plot, rect );
QwtPlotLayout::activate( plot, adjustedRect, options );
}
};
To copy to clipboard, switch view to plain text mode
and
plot->setPlotLayout( new YourPlotLayout() );
plot->setPlotLayout( new YourPlotLayout() );
To copy to clipboard, switch view to plain text mode
Then it boils down to finding an implementation for YourPlotLayout::adjustedRect(). Here you have to start with finding a square rectangle for the canvas, that has to be expanded, by the space needed for the axes, title, footer, legend.
Of course you could also try to find a complete new implementation for YourPlotLayout::activate(). In this case you would also start with the square canvas, but then you would also calculate all the other geometries yourself.
Uwe
Bookmarks