mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Shift Well Log tracks when deleting a track
This commit is contained in:
parent
06cea12447
commit
0305399c26
@ -142,15 +142,6 @@ void RiuWellLogPlot::insertTrackPlot( RiuWellLogTrack* trackPlot, size_t index )
|
|||||||
legend->contentsWidget()->layout()->setAlignment( Qt::AlignBottom | Qt::AlignHCenter );
|
legend->contentsWidget()->layout()->setAlignment( Qt::AlignBottom | Qt::AlignHCenter );
|
||||||
m_legends.insert( static_cast<int>( index ), legend );
|
m_legends.insert( static_cast<int>( index ), legend );
|
||||||
|
|
||||||
m_trackLayout->addWidget( legend, 0, static_cast<int>( index ) );
|
|
||||||
m_trackLayout->addWidget( trackPlot, 1, static_cast<int>( index ) );
|
|
||||||
m_trackLayout->setRowStretch( 1, 1 );
|
|
||||||
|
|
||||||
if ( !m_plotDefinition->areTrackLegendsVisible() )
|
|
||||||
{
|
|
||||||
legend->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
trackPlot->updateLegend();
|
trackPlot->updateLegend();
|
||||||
|
|
||||||
if ( trackPlot->isRimTrackVisible() )
|
if ( trackPlot->isRimTrackVisible() )
|
||||||
@ -161,6 +152,8 @@ void RiuWellLogPlot::insertTrackPlot( RiuWellLogTrack* trackPlot, size_t index )
|
|||||||
{
|
{
|
||||||
trackPlot->hide();
|
trackPlot->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateChildrenLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -179,6 +172,8 @@ void RiuWellLogPlot::removeTrackPlot( RiuWellLogTrack* trackPlot )
|
|||||||
QwtLegend* legend = m_legends[trackIdx];
|
QwtLegend* legend = m_legends[trackIdx];
|
||||||
m_legends.removeAt( trackIdx );
|
m_legends.removeAt( trackIdx );
|
||||||
delete legend;
|
delete legend;
|
||||||
|
|
||||||
|
updateChildrenLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -241,6 +236,8 @@ void RiuWellLogPlot::setTitleVisible( bool visible )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuWellLogPlot::updateChildrenLayout()
|
void RiuWellLogPlot::updateChildrenLayout()
|
||||||
{
|
{
|
||||||
|
reinsertTracks();
|
||||||
|
|
||||||
int trackCount = m_trackPlots.size();
|
int trackCount = m_trackPlots.size();
|
||||||
int numTracksAlreadyShown = 0;
|
int numTracksAlreadyShown = 0;
|
||||||
for ( int tIdx = 0; tIdx < trackCount; ++tIdx )
|
for ( int tIdx = 0; tIdx < trackCount; ++tIdx )
|
||||||
@ -265,9 +262,9 @@ void RiuWellLogPlot::updateChildrenLayout()
|
|||||||
RiuWellLogTrack* riuTrack = m_trackPlots[tIdx];
|
RiuWellLogTrack* riuTrack = m_trackPlots[tIdx];
|
||||||
m_trackLayout->setColumnStretch( tIdx, riuTrack->widthScaleFactor() );
|
m_trackLayout->setColumnStretch( tIdx, riuTrack->widthScaleFactor() );
|
||||||
}
|
}
|
||||||
|
|
||||||
alignCanvasTops();
|
alignCanvasTops();
|
||||||
this->update();
|
this->update();
|
||||||
|
this->repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -408,6 +405,29 @@ void RiuWellLogPlot::alignCanvasTops()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuWellLogPlot::reinsertTracks()
|
||||||
|
{
|
||||||
|
int visibleIndex = 0;
|
||||||
|
for ( int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx )
|
||||||
|
{
|
||||||
|
if ( m_trackPlots[tIdx]->isVisible() )
|
||||||
|
{
|
||||||
|
m_trackLayout->addWidget( m_legends[tIdx], 0, static_cast<int>( visibleIndex ) );
|
||||||
|
m_trackLayout->addWidget( m_trackPlots[tIdx], 1, static_cast<int>( visibleIndex ) );
|
||||||
|
m_trackLayout->setRowStretch( 1, 1 );
|
||||||
|
|
||||||
|
if ( !m_plotDefinition->areTrackLegendsVisible() )
|
||||||
|
{
|
||||||
|
m_legends[tIdx]->hide();
|
||||||
|
}
|
||||||
|
visibleIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -83,7 +83,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void updateScrollBar( double minDepth, double maxDepth );
|
void updateScrollBar( double minDepth, double maxDepth );
|
||||||
void alignCanvasTops();
|
void alignCanvasTops();
|
||||||
|
void reinsertTracks();
|
||||||
private slots:
|
private slots:
|
||||||
void slotSetMinDepth( int value );
|
void slotSetMinDepth( int value );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user