I'm add QwtPlotLegendItem to QwtPlot without the curves.
Empty rect displayed. See attach.
Function code:
QRect QwtPlotLegendItem::geometry( const QRectF &canvasRect ) const
{
QRect rect;
rect.setSize( d_data->layout->sizeHint() );
As a result, the function returns a non-empty rectangle.
I fixed it in the derived class like this:
QRect MyLegendItem::geometry(const QRectF &canvasRect) const
{
QRect r = QwtPlotLegendItem::geometry(canvasRect);
if (r.width() < 0 || r.height() < 0)
r = QRect();
return r;
}
Need to add content checking.
What do you think about this?
Bookmarks