mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Better minimum width for well log tracks (#4824)
* Better minimum width for well log tracks * Fix alignment of scrollbar in Well log plots
This commit is contained in:
@@ -87,9 +87,8 @@ void RiuWellLogTrack::setDefaults()
|
||||
axisScaleEngine( QwtPlot::yLeft )->setAttribute( QwtScaleEngine::Floating, true );
|
||||
setAxisScale( QwtPlot::yLeft, 1000, 0 );
|
||||
setXRange( 0, 100 );
|
||||
QFont font = axisFont( QwtPlot::xTop );
|
||||
int lineHeight = QFontMetrics( font ).height() + axisScaleDraw( QwtPlot::xTop )->tickLength( QwtScaleDiv::MajorTick );
|
||||
axisScaleDraw( QwtPlot::xTop )->setMinimumExtent( lineHeight );
|
||||
axisScaleDraw( QwtPlot::xTop )->setMinimumExtent( axisExtent( QwtPlot::xTop ) );
|
||||
setMinimumWidth( defaultMinimumWidth() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -119,6 +118,7 @@ void RiuWellLogTrack::setDepthTitle( const QString& title )
|
||||
{
|
||||
axisTitleY.setText( title );
|
||||
setAxisTitle( QwtPlot::yLeft, axisTitleY );
|
||||
setMinimumWidth( defaultMinimumWidth() + axisExtent( QwtPlot::yLeft ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,6 +236,14 @@ void RiuWellLogTrack::selectClosestCurve( const QPoint& pos )
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( m_plotTrackDefinition );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RiuWellLogTrack::defaultMinimumWidth()
|
||||
{
|
||||
return 80;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -374,3 +382,18 @@ double RiuWellLogTrack::getCurrentMinorTickInterval() const
|
||||
|
||||
return minorTicks.at( 1 ) - minorTicks.at( 0 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RiuWellLogTrack::axisExtent( QwtPlot::Axis axis ) const
|
||||
{
|
||||
QFont tickLabelFont = axisFont( axis );
|
||||
int lineExtent = static_cast<int>( std::ceil( axisScaleDraw( axis )->extent( tickLabelFont ) ) );
|
||||
if ( !axisTitle( axis ).text().isEmpty() )
|
||||
{
|
||||
QFont titleFont = axisTitle( axis ).font();
|
||||
lineExtent += QFontMetrics( titleFont ).height();
|
||||
}
|
||||
return lineExtent;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user