Align scrollbar with tracks

This commit is contained in:
Gaute Lindkvist
2019-09-09 16:00:52 +02:00
parent 5cfd840025
commit edbe4f5a35
2 changed files with 14 additions and 3 deletions

View File

@@ -80,10 +80,15 @@ RiuWellLogPlot::RiuWellLogPlot( RimWellLogPlot* plotDefinition, QWidget* parent
setAutoFillBackground( true );
m_scrollBar = new QScrollBar( m_plotFrame );
m_scrollBarLayout = new QVBoxLayout;
m_scrollBarLayout->setContentsMargins( 0, 50, 0, 0 );
m_plotLayout->addLayout( m_scrollBarLayout );
m_scrollBar = new QScrollBar( nullptr );
m_scrollBar->setOrientation( Qt::Vertical );
m_scrollBar->setVisible( true );
m_plotLayout->addWidget( m_scrollBar, 0 );
m_scrollBarLayout->addWidget( m_scrollBar, 0 );
new RiuPlotObjectPicker( m_plotTitle, m_plotDefinition );
@@ -353,7 +358,6 @@ void RiuWellLogPlot::updateScrollBar( double minDepth, double maxDepth )
m_scrollBar->setRange( (int)availableMinDepth, (int)( ( availableMaxDepth - visibleDepth ) ) );
m_scrollBar->setPageStep( (int)visibleDepth );
m_scrollBar->setValue( (int)minDepth );
m_scrollBar->setVisible( true );
}
m_scrollBar->blockSignals( false );
@@ -396,6 +400,12 @@ void RiuWellLogPlot::alignCanvasTops()
m_trackPlots[tIdx]->setContentsMargins( margins );
}
}
if ( m_trackLayout->columnCount() > 0 && m_trackLayout->rowCount() > 0 )
{
int legendHeight = m_trackLayout->cellRect( 0, 0 ).height();
m_scrollBarLayout->setContentsMargins( 0, legendHeight, 0, 0 );
}
}
//--------------------------------------------------------------------------------------------------

View File

@@ -93,6 +93,7 @@ protected:
QPointer<QFrame> m_plotFrame;
QPointer<QGridLayout> m_trackLayout;
QPointer<QLabel> m_plotTitle;
QPointer<QVBoxLayout> m_scrollBarLayout;
QScrollBar* m_scrollBar;
QList<QPointer<QwtLegend>> m_legends;
QList<QPointer<RiuWellLogTrack>> m_trackPlots;