Skip to content
Permalink
Browse files

Fixed ticket #37 - remove layer from toolbar didn't work correctly

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5146 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Apr 3, 2006
1 parent caa3301 commit 5d0a383ebefc0d97de89c13f7971d443414869f2
Showing with 1 addition and 28 deletions.
  1. +1 −28 src/gui/qgisapp.cpp
@@ -3574,34 +3574,7 @@ void QgisApp::inOverview()

void QgisApp::removeLayer()
{
#ifdef QGISDEBUG
std::cout << "QGisApp Removing layer" << std::endl;
#endif
//make sure canvase is not rendering first by faking an escape keypress
emit keyPressEvent(new QKeyEvent(QEvent::KeyPress ,Qt::Key_Escape,Qt::Key_Escape,0 ));
mMapCanvas->freeze();
QTreeWidgetItem *lvi = mMapLegend->currentItem();
if(lvi)
{
QgsLegendLayerFile* llf = dynamic_cast<QgsLegendLayerFile*>(lvi);
QgsLegendLayer* ll = dynamic_cast<QgsLegendLayer*>(lvi);
if(llf)
{
QgsMapLayer *layer = llf->layer();
//call the registry to unregister the layer. It will in turn
//fire a qt signal to notify any objects using that layer that they should
//remove it immediately
QgsMapLayerRegistry::instance()->removeMapLayer(layer->getLayerID());
mMapCanvas->freeze(false);

// draw the map
mMapCanvas->refresh();
}
else if(ll)
{
mMapLegend->legendLayerRemove();
}
}
mMapLegend->legendLayerRemove();
}


0 comments on commit 5d0a383

Please sign in to comment.
You can’t perform that action at this time.