#4341 Make docked plots follow font size preferences (but subtract 1 in point size)

* The docked plots have much less space available than most plots
This commit is contained in:
Gaute Lindkvist
2019-04-15 15:01:58 +02:00
parent 93f76d9739
commit edf46496b7
15 changed files with 193 additions and 17 deletions

View File

@@ -16,6 +16,7 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuDockedQwtPlot.h"
#include "RiuRelativePermeabilityPlotPanel.h"
#include "RiuRelativePermeabilityPlotUpdater.h"
#include "RiuQwtPlotCurve.h"
@@ -56,10 +57,10 @@
//
//
//==================================================================================================
class RelPermQwtPlot : public QwtPlot
class RelPermQwtPlot : public RiuDockedQwtPlot
{
public:
RelPermQwtPlot(QWidget* parent) : QwtPlot(parent) {}
RelPermQwtPlot(QWidget* parent) : RiuDockedQwtPlot(parent) {}
QSize sizeHint() const override { return QSize(100, 100); }
QSize minimumSizeHint() const override { return QSize(0, 0); }
};
@@ -88,6 +89,7 @@ RiuRelativePermeabilityPlotPanel::RiuRelativePermeabilityPlotPanel(QDockWidget*
{
m_qwtPlot = new RelPermQwtPlot(this);
setPlotDefaults(m_qwtPlot);
applyFontSizes(false);
m_selectedCurvesButtonGroup = new QButtonGroup(this);
m_selectedCurvesButtonGroup->setExclusive(false);
@@ -159,7 +161,7 @@ void RiuRelativePermeabilityPlotPanel::setPlotDefaults(QwtPlot* plot)
{
QwtText plotTitle = plot->title();
QFont titleFont = plotTitle.font();
titleFont.setPointSize(14);
titleFont.setPointSize(10);
plotTitle.setFont(titleFont);
plot->setTitle(plotTitle);
}
@@ -228,6 +230,14 @@ RiuRelativePermeabilityPlotUpdater* RiuRelativePermeabilityPlotPanel::plotUpdate
return m_plotUpdater.get();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuRelativePermeabilityPlotPanel::applyFontSizes(bool replot /*= true*/)
{
m_qwtPlot->applyFontSizes(replot);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -465,7 +475,6 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(RiaEclipseUnitTools::Unit
plot->setAxisTitle(QwtPlot::xBottom, determineXAxisTitleFromCurveCollection(curveArr));
plot->setAxisTitle(QwtPlot::yLeft, "Kr");
plot->setAxisTitle(QwtPlot::yRight, QString("Pc [%1]").arg(RiaEclipseUnitTools::unitStringPressure(unitSystem)));
plot->replot();
}