Skip to content
Permalink
Browse files

bugfix to enable/disable icons depending on layer type

git-svn-id: http://svn.osgeo.org/qgis/trunk@5071 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Mar 21, 2006
1 parent 8050a0b commit 4d5369c740f1f0d9e7ac7d7ba2c3206894c0d9d6
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 4d5369c

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