Skip to content
Permalink
Browse files
Merge branch 'master' of github.com:qgis/Quantum-GIS
  • Loading branch information
timlinux committed Apr 7, 2012
2 parents 8ae8e15 + a82a243 commit 73269255a35166724f688389fe1d8803240de6f4
Showing with 31 additions and 18 deletions.
  1. +3 −3 src/app/qgisapp.cpp
  2. +24 −13 src/app/qgssnappingdialog.cpp
  3. +4 −2 src/app/qgssnappingdialog.h
@@ -1649,11 +1649,11 @@ void QgisApp::setupConnections()
this, SLOT( markDirty() ) );

// connect map layer registry
connect( QgsMapLayerRegistry::instance(), SIGNAL( layersAdded( QgsMapLayer * ) ),
this, SLOT( layersWereAdded( QgsMapLayer * ) ) );
connect( QgsMapLayerRegistry::instance(), SIGNAL( layersAdded( QList<QgsMapLayer *> ) ),
this, SLOT( layersWereAdded( QList<QgsMapLayer *> ) ) );
connect( QgsMapLayerRegistry::instance(),
SIGNAL( layersWillBeRemoved( QStringList ) ),
this, SLOT( removingLayer( QString ) ) );
this, SLOT( removingLayers( QStringList ) ) );

// Connect warning dialog from project reading
connect( QgsProject::instance(), SIGNAL( oldProjectVersionWarning( QString ) ),
@@ -69,8 +69,8 @@ QgsSnappingDialog::QgsSnappingDialog( QWidget* parent, QgsMapCanvas* canvas ): Q
connect( mButtonBox, SIGNAL( accepted() ), this, SLOT( apply() ) );
connect( mButtonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
}
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer * ) ), this, SLOT( addLayer( QgsMapLayer * ) ) );
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( layerWillBeRemoved( QString ) ) );
connect( QgsMapLayerRegistry::instance(), SIGNAL( layersAdded( QList<QgsMapLayer * > ) ), this, SLOT( addLayers( QList<QgsMapLayer * > ) ) );
connect( QgsMapLayerRegistry::instance(), SIGNAL( layersWillBeRemoved( QStringList ) ), this, SLOT( layersWillBeRemoved( QStringList ) ) );
connect( cbxEnableTopologicalEditingCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( on_cbxEnableTopologicalEditingCheckBox_stateChanged( int ) ) );

mLayerTreeWidget->clear();
@@ -180,6 +180,14 @@ void QgsSnappingDialog::show()
QDialog::show();
}

void QgsSnappingDialog::addLayers( QList<QgsMapLayer *> layers )
{
foreach( QgsMapLayer* layer, layers )
{
addLayer( layer );
}
}

void QgsSnappingDialog::addLayer( QgsMapLayer * theMapLayer )
{
QgsVectorLayer *currentVectorLayer = qobject_cast<QgsVectorLayer *>( theMapLayer );
@@ -298,20 +306,23 @@ void QgsSnappingDialog::addLayer( QgsMapLayer * theMapLayer )
}
}

void QgsSnappingDialog::layerWillBeRemoved( QString theLayerId )
void QgsSnappingDialog::layersWillBeRemoved( QStringList thelayers )
{
QTreeWidgetItem *item = 0;

for ( int i = 0; i < mLayerTreeWidget->topLevelItemCount(); ++i )
foreach( QString theLayerId, thelayers )
{
item = mLayerTreeWidget->topLevelItem( i );
if ( item && item->data( 0, Qt::UserRole ).toString() == theLayerId )
break;
item = 0;
}
QTreeWidgetItem *item = 0;

for ( int i = 0; i < mLayerTreeWidget->topLevelItemCount(); ++i )
{
item = mLayerTreeWidget->topLevelItem( i );
if ( item && item->data( 0, Qt::UserRole ).toString() == theLayerId )
break;
item = 0;
}

if ( item )
delete item;
if ( item )
delete item;
}
}

void QgsSnappingDialog::setTopologicalEditingState()
@@ -48,8 +48,10 @@ class QgsSnappingDialog: public QDialog, private Ui::QgsSnappingDialogBase
//! add layer to tree
void addLayer( QgsMapLayer* theMapLayer );

//! layer removed
void layerWillBeRemoved( QString );
void addLayers( QList<QgsMapLayer * > layers );

//! layers removed
void layersWillBeRemoved( QStringList );

void on_cbxEnableTopologicalEditingCheckBox_stateChanged( int );

0 comments on commit 7326925

Please sign in to comment.