#2889 Fix crash when few tick marks in legend.

Set legend title before adding to view to make size calculaltion correct first time.
This commit is contained in:
Jacob Støren 2018-05-11 13:36:08 +02:00
parent f0be8214b0
commit d37ed9bb7c
3 changed files with 2 additions and 12 deletions

View File

@ -1087,8 +1087,8 @@ void RimEclipseView::updateLegends()
}
}
m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig()->titledOverlayFrame());
this->cellEdgeResult()->legendConfig()->setTitle(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariableUiShortName());
m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig()->titledOverlayFrame());
}
else
{
@ -1128,8 +1128,8 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel,
if (resultColors->hasResult() && resultColors->legendConfig()->showLegend())
{
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->titledOverlayFrame());
resultColors->legendConfig()->setTitle(legendLabel + resultColors->resultVariableUiShortName());
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->titledOverlayFrame());
}
size_t maxTimeStepCount = cellResultsData->maxTimeStepCount();

View File

@ -485,11 +485,6 @@ void CategoryLegend::layoutInfo(OverlayColorLegendLayoutInfo* layout)
colorBarWidth,
colorBarHeight);
if (layout->colorBarRect.width() < 1 || layout->colorBarRect.height() < 1)
{
return;
}
layout->tickStartX = layout->margins.x();
layout->tickMidX = layout->margins.x() + layout->colorBarRect.width();
layout->tickEndX = layout->tickMidX + 5;

View File

@ -632,11 +632,6 @@ void OverlayScalarMapperLegend::layoutInfo(OverlayColorLegendLayoutInfo* layout)
colorBarWidth,
colorBarHeight);
if (layout->colorBarRect.width() < 1 || layout->colorBarRect.height() < 1)
{
return;
}
layout->tickStartX = layout->margins.x();
layout->tickMidX = layout->margins.x() + layout->colorBarRect.width();
layout->tickEndX = layout->tickMidX + 5;