Refactor view id

This commit is contained in:
Gaute Lindkvist
2019-11-14 20:48:11 +01:00
parent d9043db5e0
commit 228810fd05
27 changed files with 237 additions and 59 deletions

View File

@@ -86,6 +86,12 @@ Rim3dView::Rim3dView( void )
RiaPreferences* preferences = app->preferences();
CVF_ASSERT( preferences );
RICF_InitField( &m_id, "ViewId", -1, "View ID", "", "", "" );
m_id.uiCapability()->setUiReadOnly( true );
m_id.uiCapability()->setUiHidden( true );
m_id.capability<RicfFieldHandle>()->setIOWriteable( false );
m_id.xmlCapability()->setCopyable( false );
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
m_nameConfig = new RimViewNameConfig();
@@ -168,6 +174,14 @@ Rim3dView::~Rim3dView( void )
m_viewer = nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int Rim3dView::id() const
{
return m_id;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -306,6 +320,27 @@ void Rim3dView::initAfterRead()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dView::setId( int id )
{
m_id = id;
QString viewIdTooltip = QString( "View id: %1" ).arg( m_id );
this->setUiToolTip( viewIdTooltip );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dView::assignIdIfNecessary()
{
if ( m_id == -1 )
{
RiaApplication::instance()->project()->assignViewIdToView( this );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------