mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-10 23:46:00 -06:00
#9117 Summary/Well Log Plot: fix missing update on legend font size change.
This commit is contained in:
parent
ffc58fedc8
commit
c16264497d
@ -40,6 +40,7 @@
|
||||
#include "RiuQwtPlotLegend.h"
|
||||
#include "RiuQwtPlotTools.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
#include "qwt_legend_label.h"
|
||||
#ifdef USE_QTCHARTS
|
||||
#include "RiuQtChartsPlotWidget.h"
|
||||
#endif
|
||||
@ -683,15 +684,8 @@ void RiuMultiPlotPage::reinsertPlotWidgets()
|
||||
{
|
||||
if ( m_plotDefinition->legendsVisible() )
|
||||
{
|
||||
int legendColumns = 1;
|
||||
if ( m_plotDefinition->legendsHorizontal() )
|
||||
{
|
||||
legendColumns = 0; // unlimited
|
||||
}
|
||||
legends[visibleIndex]->setMaxColumns( legendColumns );
|
||||
QFont legendFont = legends[visibleIndex]->font();
|
||||
legendFont.setPixelSize( m_legendFontPixelSize );
|
||||
legends[visibleIndex]->setFont( legendFont );
|
||||
updateLegendColumns( legends[visibleIndex] );
|
||||
updateLegendFont( legends[visibleIndex] );
|
||||
legends[visibleIndex]->show();
|
||||
}
|
||||
else
|
||||
@ -714,6 +708,38 @@ void RiuMultiPlotPage::reinsertPlotWidgets()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotPage::updateLegendFont( RiuQwtPlotLegend* legend )
|
||||
{
|
||||
QFont legendFont = legend->font();
|
||||
legendFont.setPixelSize( m_legendFontPixelSize );
|
||||
|
||||
// Set font size for all existing labels
|
||||
QList<QwtLegendLabel*> labels = legend->findChildren<QwtLegendLabel*>();
|
||||
for ( QwtLegendLabel* label : labels )
|
||||
{
|
||||
label->setFont( legendFont );
|
||||
}
|
||||
|
||||
legend->setFont( legendFont );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotPage::updateLegendColumns( RiuQwtPlotLegend* legend )
|
||||
{
|
||||
int legendColumns = 1;
|
||||
if ( m_plotDefinition->legendsHorizontal() )
|
||||
{
|
||||
legendColumns = 0; // unlimited
|
||||
}
|
||||
|
||||
legend->setMaxColumns( legendColumns );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -106,6 +106,9 @@ protected:
|
||||
bool hasHeightForWidth() const override;
|
||||
void updateMarginsFromPageLayout();
|
||||
|
||||
void updateLegendColumns( RiuQwtPlotLegend* legend );
|
||||
void updateLegendFont( RiuQwtPlotLegend* legend );
|
||||
|
||||
std::pair<int, int> rowAndColumnCount( int plotWidgetCount ) const;
|
||||
|
||||
void alignAxes();
|
||||
|
@ -130,15 +130,8 @@ void RiuSummaryMultiPlotPage::reinsertPlotWidgets()
|
||||
{
|
||||
if ( m_plotDefinition->legendsVisible() && !legends[visibleIndex]->isEmpty() )
|
||||
{
|
||||
int legendColumns = 1;
|
||||
if ( m_plotDefinition->legendsHorizontal() )
|
||||
{
|
||||
legendColumns = 0; // unlimited
|
||||
}
|
||||
legends[visibleIndex]->setMaxColumns( legendColumns );
|
||||
QFont legendFont = legends[visibleIndex]->font();
|
||||
legendFont.setPixelSize( m_legendFontPixelSize );
|
||||
legends[visibleIndex]->setFont( legendFont );
|
||||
updateLegendColumns( legends[visibleIndex] );
|
||||
updateLegendFont( legends[visibleIndex] );
|
||||
legends[visibleIndex]->show();
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user