mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-11 07:56:08 -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 "RiuQwtPlotLegend.h"
|
||||||
#include "RiuQwtPlotTools.h"
|
#include "RiuQwtPlotTools.h"
|
||||||
#include "RiuQwtPlotWidget.h"
|
#include "RiuQwtPlotWidget.h"
|
||||||
|
#include "qwt_legend_label.h"
|
||||||
#ifdef USE_QTCHARTS
|
#ifdef USE_QTCHARTS
|
||||||
#include "RiuQtChartsPlotWidget.h"
|
#include "RiuQtChartsPlotWidget.h"
|
||||||
#endif
|
#endif
|
||||||
@ -683,15 +684,8 @@ void RiuMultiPlotPage::reinsertPlotWidgets()
|
|||||||
{
|
{
|
||||||
if ( m_plotDefinition->legendsVisible() )
|
if ( m_plotDefinition->legendsVisible() )
|
||||||
{
|
{
|
||||||
int legendColumns = 1;
|
updateLegendColumns( legends[visibleIndex] );
|
||||||
if ( m_plotDefinition->legendsHorizontal() )
|
updateLegendFont( legends[visibleIndex] );
|
||||||
{
|
|
||||||
legendColumns = 0; // unlimited
|
|
||||||
}
|
|
||||||
legends[visibleIndex]->setMaxColumns( legendColumns );
|
|
||||||
QFont legendFont = legends[visibleIndex]->font();
|
|
||||||
legendFont.setPixelSize( m_legendFontPixelSize );
|
|
||||||
legends[visibleIndex]->setFont( legendFont );
|
|
||||||
legends[visibleIndex]->show();
|
legends[visibleIndex]->show();
|
||||||
}
|
}
|
||||||
else
|
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;
|
bool hasHeightForWidth() const override;
|
||||||
void updateMarginsFromPageLayout();
|
void updateMarginsFromPageLayout();
|
||||||
|
|
||||||
|
void updateLegendColumns( RiuQwtPlotLegend* legend );
|
||||||
|
void updateLegendFont( RiuQwtPlotLegend* legend );
|
||||||
|
|
||||||
std::pair<int, int> rowAndColumnCount( int plotWidgetCount ) const;
|
std::pair<int, int> rowAndColumnCount( int plotWidgetCount ) const;
|
||||||
|
|
||||||
void alignAxes();
|
void alignAxes();
|
||||||
|
@ -130,15 +130,8 @@ void RiuSummaryMultiPlotPage::reinsertPlotWidgets()
|
|||||||
{
|
{
|
||||||
if ( m_plotDefinition->legendsVisible() && !legends[visibleIndex]->isEmpty() )
|
if ( m_plotDefinition->legendsVisible() && !legends[visibleIndex]->isEmpty() )
|
||||||
{
|
{
|
||||||
int legendColumns = 1;
|
updateLegendColumns( legends[visibleIndex] );
|
||||||
if ( m_plotDefinition->legendsHorizontal() )
|
updateLegendFont( legends[visibleIndex] );
|
||||||
{
|
|
||||||
legendColumns = 0; // unlimited
|
|
||||||
}
|
|
||||||
legends[visibleIndex]->setMaxColumns( legendColumns );
|
|
||||||
QFont legendFont = legends[visibleIndex]->font();
|
|
||||||
legendFont.setPixelSize( m_legendFontPixelSize );
|
|
||||||
legends[visibleIndex]->setFont( legendFont );
|
|
||||||
legends[visibleIndex]->show();
|
legends[visibleIndex]->show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user