mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#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:
@@ -17,6 +17,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiuPvtPlotPanel.h"
|
||||
|
||||
#include "RiuDockedQwtPlot.h"
|
||||
#include "RiuPvtPlotUpdater.h"
|
||||
|
||||
#include "RigFlowDiagSolverInterface.h"
|
||||
@@ -49,10 +51,10 @@
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class PvtQwtPlot : public QwtPlot
|
||||
class PvtQwtPlot : public RiuDockedQwtPlot
|
||||
{
|
||||
public:
|
||||
PvtQwtPlot(QWidget* parent) : QwtPlot(parent) {}
|
||||
PvtQwtPlot(QWidget* parent) : RiuDockedQwtPlot(parent) {}
|
||||
QSize sizeHint() const override { return QSize(100, 100); }
|
||||
QSize minimumSizeHint() const override { return QSize(0, 0); }
|
||||
};
|
||||
@@ -103,6 +105,7 @@ RiuPvtPlotWidget::RiuPvtPlotWidget(RiuPvtPlotPanel* parent)
|
||||
{
|
||||
m_qwtPlot = new PvtQwtPlot(this);
|
||||
setPlotDefaults(m_qwtPlot);
|
||||
applyFontSizes(false);
|
||||
|
||||
QHBoxLayout* layout = new QHBoxLayout();
|
||||
layout->addWidget(m_qwtPlot);
|
||||
@@ -147,7 +150,7 @@ void RiuPvtPlotWidget::setPlotDefaults(QwtPlot* plot)
|
||||
// Axis number font
|
||||
{
|
||||
QFont axisFont = plot->axisFont(QwtPlot::xBottom);
|
||||
axisFont.setPointSize(10);
|
||||
axisFont.setPointSize(8);
|
||||
plot->setAxisFont(QwtPlot::xBottom, axisFont);
|
||||
plot->setAxisFont(QwtPlot::yLeft, axisFont);
|
||||
}
|
||||
@@ -156,7 +159,7 @@ void RiuPvtPlotWidget::setPlotDefaults(QwtPlot* plot)
|
||||
{
|
||||
QwtText axisTitle = plot->axisTitle(QwtPlot::xBottom);
|
||||
QFont axisTitleFont = axisTitle.font();
|
||||
axisTitleFont.setPointSize(10);
|
||||
axisTitleFont.setPointSize(8);
|
||||
axisTitleFont.setBold(false);
|
||||
axisTitle.setFont(axisTitleFont);
|
||||
axisTitle.setRenderFlags(Qt::AlignRight);
|
||||
@@ -168,7 +171,7 @@ void RiuPvtPlotWidget::setPlotDefaults(QwtPlot* plot)
|
||||
{
|
||||
QwtText plotTitle = plot->title();
|
||||
QFont titleFont = plotTitle.font();
|
||||
titleFont.setPointSize(14);
|
||||
titleFont.setPointSize(12);
|
||||
plotTitle.setFont(titleFont);
|
||||
plot->setTitle(plotTitle);
|
||||
}
|
||||
@@ -307,6 +310,14 @@ void RiuPvtPlotWidget::plotCurves(RiaEclipseUnitTools::UnitSystem unitSystem, co
|
||||
m_qwtPlot->replot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPvtPlotWidget::applyFontSizes(bool replot)
|
||||
{
|
||||
m_qwtPlot->applyFontSizes(replot);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -506,7 +517,7 @@ RiuPvtPlotPanel::RiuPvtPlotPanel(QDockWidget* parent)
|
||||
m_titleLabel = new QLabel("", this);
|
||||
m_titleLabel->setAlignment(Qt::AlignHCenter);
|
||||
QFont font = m_titleLabel->font();
|
||||
font.setPointSize(14);
|
||||
font.setPointSize(10);
|
||||
font.setBold(true);
|
||||
m_titleLabel->setFont(font);
|
||||
|
||||
@@ -593,6 +604,17 @@ RiuPvtPlotUpdater* RiuPvtPlotPanel::plotUpdater()
|
||||
return m_plotUpdater.get();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPvtPlotPanel::applyFontSizes(bool replot)
|
||||
{
|
||||
if (m_fvfPlot)
|
||||
m_fvfPlot->applyFontSizes(replot);
|
||||
if (m_viscosityPlot)
|
||||
m_viscosityPlot->applyFontSizes(replot);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user