Skip to content
Permalink
Browse files

Allow field calculator also for layers where adding new fields is not…

… possible (user will have to use one of the existing fields)

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11828 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Oct 22, 2009
1 parent ee82f84 commit d727f919f39a339fe6b329151935d7c9a51e4f2e
Showing with 9 additions and 1 deletion.
  1. +8 −0 src/app/qgsfieldcalculator.cpp
  2. +1 −1 src/app/qgsvectorlayerproperties.cpp
@@ -35,6 +35,14 @@ QgsFieldCalculator::QgsFieldCalculator( QgsVectorLayer* vl ): QDialog(), mVector

//disable ok button until there is text for output field and expression
mButtonBox->button( QDialogButtonBox::Ok )->setEnabled( false );

// disable creation of new fields if not supported by data provider
if ( !( vl->dataProvider()->capabilities() & QgsVectorDataProvider::AddAttributes ) )
{
mUpdateExistingFieldCheckBox->setEnabled( false ); // must stay checked
mNewFieldGroupBox->setEnabled( false );
mNewFieldGroupBox->setTitle( mNewFieldGroupBox->title() + tr( " (not supported by provider)" ) );
}
}

QgsFieldCalculator::~QgsFieldCalculator()
@@ -355,7 +355,7 @@ void QgsVectorLayerProperties::updateButtons()
int cap = layer->dataProvider()->capabilities();
mAddAttributeButton->setEnabled( cap & QgsVectorDataProvider::AddAttributes );
mDeleteAttributeButton->setEnabled( cap & QgsVectorDataProvider::DeleteAttributes );
mCalculateFieldButton->setEnabled(( cap & QgsVectorDataProvider::AddAttributes ) && ( cap & QgsVectorDataProvider::ChangeAttributeValues ) );
mCalculateFieldButton->setEnabled( cap & QgsVectorDataProvider::ChangeAttributeValues );
mToggleEditingButton->setChecked( true );
}
else

0 comments on commit d727f91

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