Unify the width of all visible legends.

* Calculate the minimum width to fit the content before the render pass.
  * Set the actual width of all the legends to the largest of the minimum widths.
  * This resizes the legends to always be the same size and reduces the size of you remove
     the widest legend.
This commit is contained in:
Gaute Lindkvist
2018-04-06 14:07:00 +02:00
parent 63ffade452
commit 38aa447dcd
10 changed files with 127 additions and 35 deletions

View File

@@ -43,6 +43,7 @@
RivTernarySaturationOverlayItem::RivTernarySaturationOverlayItem(cvf::Font* font)
: TitledOverlayFrame(font, 120, 150)
{
this->computeLayoutAndExtents();
}
//--------------------------------------------------------------------------------------------------
@@ -53,6 +54,14 @@ RivTernarySaturationOverlayItem::~RivTernarySaturationOverlayItem()
// Empty destructor to avoid errors with undefined types when cvf::ref's destructor gets called
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivTernarySaturationOverlayItem::computeLayoutAndExtents()
{
this->setMinimumWidth(this->sizeHint().x());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------