mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Bugfix : legend titles not handling line breaks correctly
This commit is contained in:
parent
b16482bb2f
commit
fc0d50aa2c
@ -127,9 +127,10 @@ void RiuAbstractLegendFrame::renderTo( QPainter* painter, const QRect& targetRec
|
||||
QTextDocument td;
|
||||
td.setDocumentMargin( 0.0 );
|
||||
td.setDefaultFont( this->font() );
|
||||
QString formattedTitle = m_title;
|
||||
td.setHtml( QString( "<body><font color='%1'>%2</font></body>" )
|
||||
.arg( textColor.name() )
|
||||
.arg( m_title.replace( "\n", "<br />" ) ) );
|
||||
.arg( formattedTitle.replace( "\n", "<br />" ) ) );
|
||||
td.drawContents( painter );
|
||||
painter->restore();
|
||||
}
|
||||
|
@ -78,10 +78,9 @@ void RiuScalarMapperLegendFrame::layoutInfo( LayoutInfo* layout ) const
|
||||
|
||||
int colorBarWidth = 25;
|
||||
int colorBarHeight = layout->overallLegendSize.height() - layout->margins.top() - layout->margins.bottom() -
|
||||
titleLines.size() * ( layout->charHeight + layout->lineSpacing ) - 0.5 * layout->lineSpacing;
|
||||
titleLines.size() * layout->lineSpacing - 0.5 * layout->lineSpacing;
|
||||
|
||||
int colorBarStartY = layout->margins.top() + titleLines.size() * ( layout->lineSpacing + layout->charHeight ) +
|
||||
0.5 * layout->lineSpacing;
|
||||
int colorBarStartY = layout->margins.top() + titleLines.size() * layout->lineSpacing + 0.5 * layout->lineSpacing;
|
||||
|
||||
layout->colorBarRect = QRect( layout->margins.left(), colorBarStartY, colorBarWidth, colorBarHeight );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user