Skip to content
Permalink
Browse files

bugfix to enable/disable icons depending on layer type

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5071 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Mar 21, 2006
1 parent 394f45d commit 398af139b2157a89f780cbebb12e2c7f2302def7
Showing with 22 additions and 5 deletions.
  1. +22 −5 src/gui/qgisapp.cpp
@@ -4857,6 +4857,8 @@ void QgisApp::activateDeactivateLayerRelatedActions(const QgsMapLayer* layer)
{
return;
}

/***********Vector layers****************/
if(layer->type() == QgsMapLayer::VECTOR || layer->type() == QgsMapLayer::DATABASE)
{
mActionSelect->setEnabled(true);
@@ -4866,7 +4868,7 @@ void QgisApp::activateDeactivateLayerRelatedActions(const QgsMapLayer* layer)
if(vlayer)
{
//does provider allow deleting of features?
if(dprovider->capabilities() | QgsVectorDataProvider::DeleteFeatures)
if(dprovider->capabilities() & QgsVectorDataProvider::DeleteFeatures)
{
mActionDeleteSelected->setEnabled(true);
}
@@ -4878,7 +4880,7 @@ void QgisApp::activateDeactivateLayerRelatedActions(const QgsMapLayer* layer)

if(vlayer->vectorType() == QGis::Point)
{
if(dprovider->capabilities() | QgsVectorDataProvider::AddFeatures)
if(dprovider->capabilities() & QgsVectorDataProvider::AddFeatures)
{
mActionCapturePoint->setEnabled(true);
}
@@ -4895,19 +4897,33 @@ void QgisApp::activateDeactivateLayerRelatedActions(const QgsMapLayer* layer)
}
else if(vlayer->vectorType() == QGis::Line)
{
mActionCaptureLine->setEnabled(true);
if(dprovider->capabilities() & QgsVectorDataProvider::AddFeatures)
{
mActionCaptureLine->setEnabled(true);
}
else
{
mActionCaptureLine->setEnabled(false);
}
mActionCapturePoint->setEnabled(false);
mActionCapturePolygon->setEnabled(false);
}
else if(vlayer->vectorType() == QGis::Polygon)
{
mActionCapturePolygon->setEnabled(true);
if(dprovider->capabilities() & QgsVectorDataProvider::AddFeatures)
{
mActionCapturePolygon->setEnabled(true);
}
else
{
mActionCapturePolygon->setEnabled(false);
}
mActionCapturePoint->setEnabled(false);
mActionCaptureLine->setEnabled(false);
}

//are add/delete/move vertex supported?
if(dprovider->capabilities() | QgsVectorDataProvider::ChangeGeometries)
if(dprovider->capabilities() & QgsVectorDataProvider::ChangeGeometries)
{
mActionAddVertex->setEnabled(true);
mActionMoveVertex->setEnabled(true);
@@ -4922,6 +4938,7 @@ void QgisApp::activateDeactivateLayerRelatedActions(const QgsMapLayer* layer)
return;
}
}
/*************Raster layers*************/
else if(layer->type() == QgsMapLayer::RASTER)
{
mActionSelect->setEnabled(false);

0 comments on commit 398af13

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