Curve legend: Use widget size to determine the column count

This commit is contained in:
Magne Sjaastad 2022-11-02 13:13:36 +01:00
parent e29b310566
commit 68c72c85cf

View File

@ -76,8 +76,10 @@ QSize RiuQwtPlotLegend::sizeHint() const
{
QMargins margins = this->contentsMargins();
auto widgetSize = size();
int numColumns =
std::max( 1, (int)legendLayout->columnsForWidth( fullSizeHint.width() - margins.left() - margins.right() ) );
std::max( 1, (int)legendLayout->columnsForWidth( widgetSize.width() - margins.left() - margins.right() ) );
int numRows = legendLayout->itemCount() / numColumns;
if ( numRows == 0 )
{