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:
@@ -51,6 +51,12 @@ RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefiniti
|
||||
font.setBold(true);
|
||||
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);
|
||||
|
||||
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()));
|
||||
|
||||
if (!m_plotDefinition->isTrackLegendsVisible())
|
||||
{
|
||||
legend->hide();
|
||||
}
|
||||
|
||||
trackPlot->updateLegend();
|
||||
|
||||
if (trackPlot->isRimTrackVisible())
|
||||
@@ -263,19 +268,21 @@ void RiuWellLogPlot::placeChildWidgets(int height, int width)
|
||||
|
||||
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 (legendHeight > maxLegendHeight) maxLegendHeight = legendHeight;
|
||||
if ( m_trackPlots[tIdx]->isVisible() )
|
||||
{
|
||||
int legendHeight = m_legends[tIdx]->sizeHint().height();
|
||||
if ( legendHeight > maxLegendHeight ) maxLegendHeight = legendHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int trackHeight = height - maxLegendHeight;
|
||||
int trackX = 0;
|
||||
|
||||
|
||||
if (visibleTrackCount)
|
||||
{
|
||||
int trackWidth = (width - scrollBarWidth)/visibleTrackCount;
|
||||
|
||||
Reference in New Issue
Block a user