Fix update of track names following DnD

This commit is contained in:
Gaute Lindkvist 2019-10-24 14:01:16 +02:00
parent 88a80c1b71
commit b343aa1ae9
4 changed files with 33 additions and 33 deletions

View File

@ -207,22 +207,10 @@ void RimGridPlotWindow::updateLayout()
}
}
#if 0
//--------------------------------------------------------------------------------------------------
///
/// Empty default implementation
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::updatePlotNames()
{
auto plotVector = plots();
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )
{
QString description = plotVector[tIdx]->description();
QRegularExpression regexp( "Track \\d+" );
description.replace( regexp, QString( "Track %1" ).arg( tIdx + 1 ) );
plotVector[tIdx]->setDescription( description );
}
}
#endif
void RimGridPlotWindow::updatePlotNames() {}
//--------------------------------------------------------------------------------------------------
///
@ -234,7 +222,7 @@ void RimGridPlotWindow::updatePlotOrderFromGridWidget()
auto indexRhs = m_viewer->indexOfPlotWidget( toPlotInterfaceAsserted( rhs )->viewer() );
return indexLhs < indexRhs;
} );
// updatePlotNames();
updatePlotNames();
updateConnectedEditors();
}
@ -323,10 +311,10 @@ QString RimGridPlotWindow::asciiDataForPlotExport() const
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::onPlotAdditionOrRemoval()
{
// updatePlotNames();
updateColumnCount();
updatePlotNames();
updateConnectedEditors();
updateLayout();
RiuPlotMainWindowTools::refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
@ -385,7 +373,7 @@ void RimGridPlotWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
if ( changedField == &m_columnCountEnum )
{
updateLayout();
updateColumnCount();
RiuPlotMainWindowTools::refreshToolbars();
}
updateConnectedEditors();
}
@ -579,14 +567,6 @@ void RimGridPlotWindow::detachAllCurves()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::updateColumnCount()
{
RiuPlotMainWindowTools::refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -66,9 +66,9 @@ public:
std::vector<RimPlotInterface*> plots() const;
std::vector<RimPlotInterface*> visiblePlots() const;
void updateLayout() override;
// void updatePlotNames();
void updatePlotOrderFromGridWidget();
void updateLayout() override;
virtual void updatePlotNames();
void updatePlotOrderFromGridWidget();
virtual void setAutoScaleXEnabled( bool enabled );
virtual void setAutoScaleYEnabled( bool enabled );
@ -114,8 +114,6 @@ protected:
private:
void detachAllCurves() override;
void updateColumnCount();
static RimPlotInterface* toPlotInterfaceAsserted( caf::PdmObject* pdmObject );
static const RimPlotInterface* toPlotInterfaceAsserted( const caf::PdmObject* pdmObject );
static caf::PdmObject* toPdmObjectAsserted( RimPlotInterface* plotInterface );

View File

@ -106,8 +106,8 @@ RimWellLogPlot::RimWellLogPlot()
m_nameConfig.uiCapability()->setUiTreeChildrenHidden( true );
m_nameConfig = new RimWellLogPlotNameConfig();
m_availableDepthUnits = {RiaDefines::UNIT_METER, RiaDefines::UNIT_FEET};
m_availableDepthTypes = {MEASURED_DEPTH, TRUE_VERTICAL_DEPTH};
m_availableDepthUnits = { RiaDefines::UNIT_METER, RiaDefines::UNIT_FEET };
m_availableDepthTypes = { MEASURED_DEPTH, TRUE_VERTICAL_DEPTH };
m_minAvailableDepth = HUGE_VAL;
m_maxAvailableDepth = -HUGE_VAL;
@ -519,6 +519,26 @@ void RimWellLogPlot::onPlotAdditionOrRemoval()
RimGridPlotWindow::onPlotAdditionOrRemoval();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::updatePlotNames()
{
auto plotVector = plots();
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )
{
RimWellLogTrack* track = dynamic_cast<RimWellLogTrack*>( plotVector[tIdx] );
CAF_ASSERT( track );
if ( track )
{
QString description = track->description();
QRegularExpression regexp( "Track \\d+" );
description.replace( regexp, QString( "Track %1" ).arg( tIdx + 1 ) );
track->setDescription( description );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -109,6 +109,8 @@ public:
void onPlotAdditionOrRemoval() override;
void updatePlotNames() override;
protected:
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
void performAutoNameUpdate() override;