Skip to content

Commit

Permalink
Fixed ticket #37 - remove layer from toolbar didn't work correctly
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5146 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Apr 3, 2006
1 parent caa3301 commit 5d0a383
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions src/gui/qgisapp.cpp
Expand Up @@ -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();
}


Expand Down

0 comments on commit 5d0a383

Please sign in to comment.