mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1173 Added the possibility to hide the legend in a Well Alloc plots ((including WellLog plot )
Also changed the background color to white.
This commit is contained in:
parent
d1743be8e7
commit
3e7413831a
@ -73,6 +73,7 @@ RimWellLogPlot::RimWellLogPlot()
|
|||||||
CAF_PDM_InitField(&m_minVisibleDepth, "MinimumDepth", 0.0, "Min", "", "", "");
|
CAF_PDM_InitField(&m_minVisibleDepth, "MinimumDepth", 0.0, "Min", "", "", "");
|
||||||
CAF_PDM_InitField(&m_maxVisibleDepth, "MaximumDepth", 1000.0, "Max", "", "", "");
|
CAF_PDM_InitField(&m_maxVisibleDepth, "MaximumDepth", 1000.0, "Max", "", "", "");
|
||||||
CAF_PDM_InitField(&m_isAutoScaleDepthEnabled, "AutoScaleDepthEnabled", true, "Auto Scale", "", "", "");
|
CAF_PDM_InitField(&m_isAutoScaleDepthEnabled, "AutoScaleDepthEnabled", true, "Auto Scale", "", "", "");
|
||||||
|
CAF_PDM_InitField(&m_showTrackLegends, "ShowTrackLegends", true, "Show Legends", "", "", "");
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_tracks, "Tracks", "", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_tracks, "Tracks", "", "", "", "");
|
||||||
m_tracks.uiCapability()->setUiHidden(true);
|
m_tracks.uiCapability()->setUiHidden(true);
|
||||||
@ -115,11 +116,18 @@ void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
|||||||
updateMdiWindowTitle();
|
updateMdiWindowTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changedField == &m_depthType ||
|
if ( changedField == &m_depthType
|
||||||
changedField == &m_depthUnit)
|
|| changedField == &m_depthUnit)
|
||||||
{
|
{
|
||||||
updateTracks();
|
updateTracks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( changedField == &m_showTrackLegends)
|
||||||
|
{
|
||||||
|
updateTracks();
|
||||||
|
if (m_viewer) m_viewer->updateChildrenLayout();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -396,6 +404,8 @@ void RimWellLogPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
|||||||
gridGroup->add(&m_minVisibleDepth);
|
gridGroup->add(&m_minVisibleDepth);
|
||||||
gridGroup->add(&m_maxVisibleDepth);
|
gridGroup->add(&m_maxVisibleDepth);
|
||||||
|
|
||||||
|
uiOrdering.add(&m_showTrackLegends);
|
||||||
|
|
||||||
uiOrdering.setForgetRemainingFields(true);
|
uiOrdering.setForgetRemainingFields(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -619,6 +629,14 @@ QString RimWellLogPlot::depthPlotTitle() const
|
|||||||
return depthTitle;
|
return depthTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimWellLogPlot::isTrackLegendsVisible() const
|
||||||
|
{
|
||||||
|
return m_showTrackLegends();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -68,6 +68,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
QString depthPlotTitle() const;
|
QString depthPlotTitle() const;
|
||||||
|
bool isTrackLegendsVisible() const;
|
||||||
|
|
||||||
void addTrack(RimWellLogTrack* track);
|
void addTrack(RimWellLogTrack* track);
|
||||||
void insertTrack(RimWellLogTrack* track, size_t index);
|
void insertTrack(RimWellLogTrack* track, size_t index);
|
||||||
@ -134,6 +135,7 @@ private:
|
|||||||
caf::PdmField<double> m_minVisibleDepth;
|
caf::PdmField<double> m_minVisibleDepth;
|
||||||
caf::PdmField<double> m_maxVisibleDepth;
|
caf::PdmField<double> m_maxVisibleDepth;
|
||||||
caf::PdmField<bool> m_isAutoScaleDepthEnabled;
|
caf::PdmField<bool> m_isAutoScaleDepthEnabled;
|
||||||
|
caf::PdmField<bool> m_showTrackLegends;
|
||||||
|
|
||||||
double m_minAvailableDepth;
|
double m_minAvailableDepth;
|
||||||
double m_maxAvailableDepth;
|
double m_maxAvailableDepth;
|
||||||
|
@ -51,6 +51,12 @@ RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefiniti
|
|||||||
font.setBold(true);
|
font.setBold(true);
|
||||||
m_titleLabel->setFont(font);
|
m_titleLabel->setFont(font);
|
||||||
|
|
||||||
|
// White background
|
||||||
|
QPalette pal = this->palette();
|
||||||
|
pal.setColor(QPalette::Background, Qt::white);
|
||||||
|
this->setAutoFillBackground(true);
|
||||||
|
this->setPalette(pal);
|
||||||
|
|
||||||
mainLayout->addWidget(m_titleLabel, 0, Qt::AlignCenter);
|
mainLayout->addWidget(m_titleLabel, 0, Qt::AlignCenter);
|
||||||
|
|
||||||
QHBoxLayout* plotWidgetsLayout = new QHBoxLayout();
|
QHBoxLayout* plotWidgetsLayout = new QHBoxLayout();
|
||||||
|
@ -96,6 +96,11 @@ void RiuWellLogPlot::insertTrackPlot(RiuWellLogTrack* trackPlot, size_t index)
|
|||||||
|
|
||||||
this->connect(trackPlot, SIGNAL(legendDataChanged(const QVariant &, const QList< QwtLegendData > &)), SLOT(scheduleUpdateChildrenLayout()));
|
this->connect(trackPlot, SIGNAL(legendDataChanged(const QVariant &, const QList< QwtLegendData > &)), SLOT(scheduleUpdateChildrenLayout()));
|
||||||
|
|
||||||
|
if (!m_plotDefinition->isTrackLegendsVisible())
|
||||||
|
{
|
||||||
|
legend->hide();
|
||||||
|
}
|
||||||
|
|
||||||
trackPlot->updateLegend();
|
trackPlot->updateLegend();
|
||||||
|
|
||||||
if (trackPlot->isRimTrackVisible())
|
if (trackPlot->isRimTrackVisible())
|
||||||
@ -263,19 +268,21 @@ void RiuWellLogPlot::placeChildWidgets(int height, int width)
|
|||||||
|
|
||||||
int maxLegendHeight = 0;
|
int maxLegendHeight = 0;
|
||||||
|
|
||||||
for (int tIdx = 0; tIdx < trackCount; ++tIdx)
|
if (m_plotDefinition->isTrackLegendsVisible())
|
||||||
{
|
{
|
||||||
if (m_trackPlots[tIdx]->isVisible())
|
for ( int tIdx = 0; tIdx < trackCount; ++tIdx )
|
||||||
{
|
{
|
||||||
int legendHeight = m_legends[tIdx]->sizeHint().height();
|
if ( m_trackPlots[tIdx]->isVisible() )
|
||||||
if (legendHeight > maxLegendHeight) maxLegendHeight = legendHeight;
|
{
|
||||||
|
int legendHeight = m_legends[tIdx]->sizeHint().height();
|
||||||
|
if ( legendHeight > maxLegendHeight ) maxLegendHeight = legendHeight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int trackHeight = height - maxLegendHeight;
|
int trackHeight = height - maxLegendHeight;
|
||||||
int trackX = 0;
|
int trackX = 0;
|
||||||
|
|
||||||
|
|
||||||
if (visibleTrackCount)
|
if (visibleTrackCount)
|
||||||
{
|
{
|
||||||
int trackWidth = (width - scrollBarWidth)/visibleTrackCount;
|
int trackWidth = (width - scrollBarWidth)/visibleTrackCount;
|
||||||
|
Loading…
Reference in New Issue
Block a user