mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4781 Make sure horizontal well log plot legends expand vertically if needed.
This commit is contained in:
parent
f2be5c00fd
commit
4852f729ff
@ -379,6 +379,8 @@ void RiuWellLogPlot::alignCanvasTops()
|
||||
}
|
||||
}
|
||||
|
||||
int legendHeight = 0;
|
||||
|
||||
for ( int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx )
|
||||
{
|
||||
if ( m_trackPlots[tIdx]->isVisible() )
|
||||
@ -395,13 +397,18 @@ void RiuWellLogPlot::alignCanvasTops()
|
||||
QMargins margins = m_trackPlots[tIdx]->contentsMargins();
|
||||
margins.setTop( margins.top() + canvasShift );
|
||||
m_trackPlots[tIdx]->setContentsMargins( margins );
|
||||
|
||||
if ( m_legends[tIdx]->isVisible() )
|
||||
{
|
||||
legendHeight = std::max( legendHeight, m_legends[tIdx]->heightForWidth( canvasRect.width() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_trackLayout->columnCount() > 0 && m_trackLayout->rowCount() > 0 )
|
||||
if ( m_plotDefinition->areTrackLegendsVisible() && m_trackLayout->columnCount() > 0 && m_trackLayout->rowCount() > 0 )
|
||||
{
|
||||
int legendHeight = m_trackLayout->cellRect( 0, 0 ).height();
|
||||
m_scrollBarLayout->setContentsMargins( 0, legendHeight, 0, 0 );
|
||||
m_trackLayout->setRowMinimumHeight( 0, legendHeight );
|
||||
}
|
||||
}
|
||||
|
||||
@ -417,7 +424,7 @@ void RiuWellLogPlot::reinsertTracks()
|
||||
{
|
||||
m_trackLayout->addWidget( m_legends[tIdx], 0, static_cast<int>( visibleIndex ) );
|
||||
m_trackLayout->addWidget( m_trackPlots[tIdx], 1, static_cast<int>( visibleIndex ) );
|
||||
m_trackLayout->setRowStretch( 1, 1 );
|
||||
m_trackLayout->setRowStretch( 1, 10 );
|
||||
|
||||
if ( !m_plotDefinition->areTrackLegendsVisible() )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user