mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4255 Read default plot font sizes from preferences and apply
This commit is contained in:
@@ -539,6 +539,61 @@ size_t RimSummaryPlot::singleColorCurveCount() const
|
||||
return colorIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryPlot::hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType, int defaultFontSize) const
|
||||
{
|
||||
if (fontSettingType != RiaDefines::PLOT_FONT) return false;
|
||||
|
||||
for (auto plotAxis : allPlotAxes())
|
||||
{
|
||||
if (plotAxis->titleFontSize() != defaultFontSize || plotAxis->valuesFontSize() != defaultFontSize)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_legendFontSize() != defaultFontSize)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryPlot::applyFontSize(RiaDefines::FontSettingType fontSettingType, int oldFontSize, int fontSize, bool forceChange /*= false*/)
|
||||
{
|
||||
if (fontSettingType != RiaDefines::PLOT_FONT) return false;
|
||||
|
||||
bool anyChange = false;
|
||||
for (auto plotAxis : allPlotAxes())
|
||||
{
|
||||
if (forceChange || plotAxis->titleFontSize() == oldFontSize)
|
||||
{
|
||||
plotAxis->setTitleFontSize(fontSize);
|
||||
anyChange = true;
|
||||
}
|
||||
if (forceChange || plotAxis->valuesFontSize() == oldFontSize)
|
||||
{
|
||||
plotAxis->setValuesFontSize(fontSize);
|
||||
anyChange = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (forceChange || m_legendFontSize() == oldFontSize)
|
||||
{
|
||||
m_legendFontSize = fontSize;
|
||||
anyChange = true;
|
||||
}
|
||||
|
||||
if (anyChange) loadDataAndUpdate();
|
||||
|
||||
return anyChange;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -847,12 +902,12 @@ void RimSummaryPlot::updateTimeAxis()
|
||||
|
||||
QFont font = timeAxisTitle.font();
|
||||
font.setBold(true);
|
||||
font.setPixelSize(m_timeAxisProperties->titleFontSize);
|
||||
font.setPointSize(m_timeAxisProperties->titleFontSize());
|
||||
timeAxisTitle.setFont(font);
|
||||
|
||||
timeAxisTitle.setText(axisTitle);
|
||||
|
||||
switch ( m_timeAxisProperties->titlePositionEnum() )
|
||||
switch ( m_timeAxisProperties->titlePosition() )
|
||||
{
|
||||
case RimSummaryTimeAxisProperties::AXIS_TITLE_CENTER:
|
||||
timeAxisTitle.setRenderFlags(Qt::AlignCenter);
|
||||
@@ -868,7 +923,7 @@ void RimSummaryPlot::updateTimeAxis()
|
||||
{
|
||||
QFont timeAxisFont = m_qwtPlot->axisFont(QwtPlot::xBottom);
|
||||
timeAxisFont.setBold(false);
|
||||
timeAxisFont.setPixelSize(m_timeAxisProperties->valuesFontSize);
|
||||
timeAxisFont.setPointSize(m_timeAxisProperties->valuesFontSize());
|
||||
m_qwtPlot->setAxisFont(QwtPlot::xBottom, timeAxisFont);
|
||||
}
|
||||
}
|
||||
@@ -1337,6 +1392,14 @@ void RimSummaryPlot::updateAxisRangesFromQwt()
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RimPlotAxisPropertiesInterface*> RimSummaryPlot::allPlotAxes() const
|
||||
{
|
||||
return { m_timeAxisProperties, m_bottomAxisProperties, m_leftYAxisProperties, m_rightYAxisProperties };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1518,7 +1581,7 @@ void RimSummaryPlot::updateMdiWindowTitle()
|
||||
QwtLegend* legend = new QwtLegend(m_qwtPlot);
|
||||
|
||||
auto font = legend->font();
|
||||
font.setPixelSize(m_legendFontSize());
|
||||
font.setPointSize(m_legendFontSize());
|
||||
legend->setFont(font);
|
||||
m_qwtPlot->insertLegend(legend, QwtPlot::BottomLegend);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user