Skip to content

Commit

Permalink
bugfix to enable/disable icons depending on layer type
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5071 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Mar 21, 2006
1 parent 394f45d commit 398af13
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions src/gui/qgisapp.cpp
Expand Up @@ -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);
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
Expand All @@ -4922,6 +4938,7 @@ void QgisApp::activateDeactivateLayerRelatedActions(const QgsMapLayer* layer)
return;
}
}
/*************Raster layers*************/
else if(layer->type() == QgsMapLayer::RASTER)
{
mActionSelect->setEnabled(false);
Expand Down

0 comments on commit 398af13

Please sign in to comment.