#1165 Added title to well allocation plot

This commit is contained in:
Magne Sjaastad 2017-02-02 14:17:36 +01:00
parent f3a4242826
commit 40dbf78aa9
4 changed files with 72 additions and 11 deletions

View File

@ -312,6 +312,26 @@ void RimWellAllocationPlot::addStackedCurve(const QString& tracerName,
curve->loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::updateWidgetTitleWindowTitle()
{
updateMdiWindowTitle();
if (m_wellAllocationPlotWidget)
{
if (m_showPlotTitle)
{
m_wellAllocationPlotWidget->showTitle(m_userName);
}
else
{
m_wellAllocationPlotWidget->hideTitle();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -446,7 +466,7 @@ void RimWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedF
if (changedField == &m_userName ||
changedField == &m_showPlotTitle)
{
updateMdiWindowTitle();
updateWidgetTitleWindowTitle();
}
else if ( changedField == &m_wellName
|| changedField == &m_case
@ -474,7 +494,8 @@ QImage RimWellAllocationPlot::snapshotWindowContent()
void RimWellAllocationPlot::setDescription(const QString& description)
{
m_userName = description;
this->updateMdiWindowTitle();
updateWidgetTitleWindowTitle();
}
//--------------------------------------------------------------------------------------------------

View File

@ -85,6 +85,8 @@ private:
const std::vector<double>& connNumbers,
const std::vector<double>& accFlow,
RimWellLogTrack* plotTrack);
void updateWidgetTitleWindowTitle();
// RimViewWindow overrides

View File

@ -25,27 +25,41 @@
#include "RimWellLogTrack.h"
#include "RimTotalWellAllocationPlot.h"
#include "QBoxLayout"
#include <QBoxLayout>
#include <QLabel>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent)
: QFrame(parent)
RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent)
: m_plotDefinition(plotDefinition),
QFrame(parent)
{
Q_ASSERT(plotDefinition);
this->setLayout(new QHBoxLayout());
Q_ASSERT(m_plotDefinition);
QVBoxLayout* mainLayout = new QVBoxLayout();
this->setLayout(mainLayout);
this->layout()->setMargin(0);
m_plotDefinition = plotDefinition;
m_titleLabel = new QLabel(this);
QFont font = m_titleLabel->font();
font.setPointSize(36);
font.setBold(true);
m_titleLabel->setFont(font);
mainLayout->addWidget(m_titleLabel, 1, Qt::AlignCenter);
QHBoxLayout* plotWidgetsLayout = new QHBoxLayout();
mainLayout->addLayout(plotWidgetsLayout, 10);
QWidget* totalFlowAllocationWidget = m_plotDefinition->totalWellFlowPlot()->createViewWidget(this);
this->layout()->addWidget(totalFlowAllocationWidget);
plotWidgetsLayout->addWidget(totalFlowAllocationWidget);
QWidget* wellFlowWidget = m_plotDefinition->accumulatedWellFlowPlot()->createViewWidget(this);
this->layout()->addWidget(wellFlowWidget);
plotWidgetsLayout->addWidget(wellFlowWidget);
}
//--------------------------------------------------------------------------------------------------
@ -67,6 +81,24 @@ RimWellAllocationPlot* RiuWellAllocationPlot::ownerPlotDefinition()
return m_plotDefinition;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::showTitle(const QString& title)
{
m_titleLabel->show();
m_titleLabel->setText(title);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::hideTitle()
{
m_titleLabel->hide();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -23,10 +23,12 @@
#include "cafPdmPointer.h"
#include <QPointer>
#include <QFrame>
class RimWellAllocationPlot;
class QLabel;
//==================================================================================================
//
//
@ -41,6 +43,9 @@ public:
RimWellAllocationPlot* ownerPlotDefinition();
void showTitle(const QString& title);
void hideTitle();
protected:
virtual QSize sizeHint() const override;
virtual QSize minimumSizeHint() const override;
@ -50,5 +55,6 @@ private:
private:
caf::PdmPointer<RimWellAllocationPlot> m_plotDefinition;
QPointer<QLabel> m_titleLabel;
};