#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(); 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 || if (changedField == &m_userName ||
changedField == &m_showPlotTitle) changedField == &m_showPlotTitle)
{ {
updateMdiWindowTitle(); updateWidgetTitleWindowTitle();
} }
else if ( changedField == &m_wellName else if ( changedField == &m_wellName
|| changedField == &m_case || changedField == &m_case
@ -474,7 +494,8 @@ QImage RimWellAllocationPlot::snapshotWindowContent()
void RimWellAllocationPlot::setDescription(const QString& description) void RimWellAllocationPlot::setDescription(const QString& description)
{ {
m_userName = description; m_userName = description;
this->updateMdiWindowTitle();
updateWidgetTitleWindowTitle();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

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

View File

@ -25,27 +25,41 @@
#include "RimWellLogTrack.h" #include "RimWellLogTrack.h"
#include "RimTotalWellAllocationPlot.h" #include "RimTotalWellAllocationPlot.h"
#include "QBoxLayout" #include <QBoxLayout>
#include <QLabel>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent) RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent)
: QFrame(parent) : m_plotDefinition(plotDefinition),
QFrame(parent)
{ {
Q_ASSERT(plotDefinition); Q_ASSERT(m_plotDefinition);
this->setLayout(new QHBoxLayout());
QVBoxLayout* mainLayout = new QVBoxLayout();
this->setLayout(mainLayout);
this->layout()->setMargin(0); 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); QWidget* totalFlowAllocationWidget = m_plotDefinition->totalWellFlowPlot()->createViewWidget(this);
this->layout()->addWidget(totalFlowAllocationWidget); plotWidgetsLayout->addWidget(totalFlowAllocationWidget);
QWidget* wellFlowWidget = m_plotDefinition->accumulatedWellFlowPlot()->createViewWidget(this); QWidget* wellFlowWidget = m_plotDefinition->accumulatedWellFlowPlot()->createViewWidget(this);
this->layout()->addWidget(wellFlowWidget); plotWidgetsLayout->addWidget(wellFlowWidget);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -67,6 +81,24 @@ RimWellAllocationPlot* RiuWellAllocationPlot::ownerPlotDefinition()
return m_plotDefinition; 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 "cafPdmPointer.h"
#include <QPointer> #include <QPointer>
#include <QFrame>
class RimWellAllocationPlot; class RimWellAllocationPlot;
class QLabel;
//================================================================================================== //==================================================================================================
// //
// //
@ -41,6 +43,9 @@ public:
RimWellAllocationPlot* ownerPlotDefinition(); RimWellAllocationPlot* ownerPlotDefinition();
void showTitle(const QString& title);
void hideTitle();
protected: protected:
virtual QSize sizeHint() const override; virtual QSize sizeHint() const override;
virtual QSize minimumSizeHint() const override; virtual QSize minimumSizeHint() const override;
@ -50,5 +55,6 @@ private:
private: private:
caf::PdmPointer<RimWellAllocationPlot> m_plotDefinition; caf::PdmPointer<RimWellAllocationPlot> m_plotDefinition;
QPointer<QLabel> m_titleLabel;
}; };