Commit 624fb29b authored by Guillaume Pasero's avatar Guillaume Pasero

BUG: Mantis-1420: update the layer name in the reference layer comboBox

parent 398b1f69
......@@ -1562,6 +1562,14 @@ MainWindow
this,
SLOT( OnReferenceLayerChanged( size_t ) )
);
QObject::connect(
model,
SIGNAL( LayerRenamed() ),
// to:
this,
SLOT( RefreshReferenceLayerComboBox() )
);
}
/*****************************************************************************/
......@@ -1597,21 +1605,11 @@ MainWindow
AbstractLayerModel * layer = model->At( i );
assert( layer!=NULL );
if( layer->inherits( VectorImageModel::staticMetaObject.className() ) )
{
const VectorImageModel * vectorImageModel =
qobject_cast< const VectorImageModel * >( layer );
assert( vectorImageModel!=NULL );
comboBox->addItem(
QString( "%1 (%2)" )
.arg( layer->GetAuthorityCode( true ).c_str() )
.arg( QFileInfo( vectorImageModel->GetFilename() ).fileName() )
);
}
else
qDebug() << "Unhandled AbstractLayerModel subclass.";
comboBox->addItem(
QString( "%1 (%2)" )
.arg( layer->GetAuthorityCode( true ).c_str() )
.arg( layer->GetName() )
);
}
{
......@@ -1683,6 +1681,14 @@ MainWindow
this,
SLOT( OnReferenceLayerChanged( size_t ) )
);
QObject::connect(
model,
SIGNAL( LayerRenamed() ),
// to:
this,
SLOT( RefreshReferenceLayerComboBox() )
);
}
comboBox->clear();
......
......@@ -161,6 +161,9 @@ signals:
void VisibilityChanged( bool =true );
void VisibilityChanged( AbstractLayerModel *, bool );
/** Signal to other components that the name has changed */
void NameChanged();
/*-[ PROTECTED SECTION ]---------------------------------------------------*/
//
......
......@@ -254,6 +254,8 @@ signals:
void ResolutionsChanged( const PixelInfo::Vector & );
void LayerRenamed();
/*-[ PROTECTED SECTION ]---------------------------------------------------*/
//
......
......@@ -189,6 +189,7 @@ AbstractLayerModel
if (name != m_Name)
{
m_Name = name;
emit NameChanged();
}
}
......
......@@ -270,6 +270,15 @@ StackedLayerModel
// Remove layer-model.
AbstractLayerModel * layer = it->second;
// Disconnect the renaming signals
QObject::disconnect(
layer,
SIGNAL( NameChanged() ),
// from:
this,
SIGNAL( LayerRenamed() )
);
m_LayerModels.erase( it );
m_Keys.erase( m_Keys.begin() + index );
......@@ -394,6 +403,15 @@ StackedLayerModel
m_LayerModels.insert( LayerModelMap::value_type( key, model ) );
m_Keys.insert( m_Keys.begin() + index, key );
// Connect the renaming signals
QObject::connect(
model,
SIGNAL( NameChanged() ),
// to:
this,
SIGNAL( LayerRenamed() )
);
//
// Update pointer to current.
if( emitCurrentChanged )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment