diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index 7c2112898a..091016f94e 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -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(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h index f94c98c512..c9c5ce018c 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h @@ -85,6 +85,8 @@ private: const std::vector& connNumbers, const std::vector& accFlow, RimWellLogTrack* plotTrack); + + void updateWidgetTitleWindowTitle(); // RimViewWindow overrides diff --git a/ApplicationCode/UserInterface/RiuWellAllocationPlot.cpp b/ApplicationCode/UserInterface/RiuWellAllocationPlot.cpp index 60e0134d54..94e8696a88 100644 --- a/ApplicationCode/UserInterface/RiuWellAllocationPlot.cpp +++ b/ApplicationCode/UserInterface/RiuWellAllocationPlot.cpp @@ -25,27 +25,41 @@ #include "RimWellLogTrack.h" #include "RimTotalWellAllocationPlot.h" -#include "QBoxLayout" +#include +#include //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -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(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuWellAllocationPlot.h b/ApplicationCode/UserInterface/RiuWellAllocationPlot.h index 9c4dd2e7c2..a466dadc77 100644 --- a/ApplicationCode/UserInterface/RiuWellAllocationPlot.h +++ b/ApplicationCode/UserInterface/RiuWellAllocationPlot.h @@ -23,10 +23,12 @@ #include "cafPdmPointer.h" #include - +#include 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 m_plotDefinition; + QPointer m_titleLabel; };