mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5473 Improve WBS plot layout by removing gaps and tweaking column spans
This commit is contained in:
@@ -182,6 +182,7 @@ void RiuQwtPlotWidget::setAxisFontsAndAlignment( QwtPlot::Axis axis,
|
||||
axisTitle.setRenderFlags( alignment | Qt::TextWordWrap );
|
||||
|
||||
setAxisTitle( axis, axisTitle );
|
||||
applyAxisTitleToQwt( axis );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -275,6 +276,7 @@ void RiuQwtPlotWidget::setAxisLabelsAndTicksEnabled( QwtPlot::Axis axis, bool en
|
||||
{
|
||||
this->axisScaleDraw( axis )->enableComponent( QwtAbstractScaleDraw::Ticks, enable );
|
||||
this->axisScaleDraw( axis )->enableComponent( QwtAbstractScaleDraw::Labels, enable );
|
||||
recalculateAxisExtents( axis );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -367,10 +369,14 @@ double RiuQwtPlotWidget::minorTickInterval( QwtPlot::Axis axis ) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RiuQwtPlotWidget::axisExtent( QwtPlot::Axis axis ) const
|
||||
{
|
||||
int lineExtent = 5;
|
||||
int lineExtent = 0;
|
||||
|
||||
lineExtent += this->axisScaleDraw( axis )->maxTickLength();
|
||||
if ( this->axisScaleDraw( axis )->hasComponent( QwtAbstractScaleDraw::Ticks ) )
|
||||
{
|
||||
lineExtent += this->axisScaleDraw( axis )->maxTickLength();
|
||||
}
|
||||
|
||||
if ( this->axisScaleDraw( axis )->hasComponent( QwtAbstractScaleDraw::Labels ) )
|
||||
{
|
||||
QFont tickLabelFont = axisFont( axis );
|
||||
// Make space for a fairly long value label
|
||||
@@ -641,12 +647,8 @@ void RiuQwtPlotWidget::applyAxisTitleToQwt( QwtPlot::Axis axis )
|
||||
axisTitle.setText( titleToApply );
|
||||
|
||||
setAxisTitle( axis, axisTitle );
|
||||
if ( axis == QwtPlot::yLeft || axis == QwtPlot::yRight )
|
||||
{
|
||||
axisScaleDraw( axis )->setMinimumExtent( axisExtent( axis ) );
|
||||
setMinimumWidth( defaultMinimumWidth() + axisExtent( axis ) );
|
||||
}
|
||||
}
|
||||
recalculateAxisExtents( axis );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -780,6 +782,19 @@ void RiuQwtPlotWidget::onAxisSelected( QwtScaleWidget* scale, bool toggleItemInS
|
||||
emit axisSelected( axisId, toggleItemInSelection );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQwtPlotWidget::recalculateAxisExtents( QwtPlot::Axis axis )
|
||||
{
|
||||
if ( axis == QwtPlot::yLeft || axis == QwtPlot::yRight )
|
||||
{
|
||||
int extent = axisExtent( axis );
|
||||
axisScaleDraw( axis )->setMinimumExtent( extent );
|
||||
setMinimumWidth( defaultMinimumWidth() + extent );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user