Skip to content
Permalink
Browse files

Change default behaviour of field calculator dialog (fixes ticket #2542)

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13046 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Mar 11, 2010
1 parent c5452ac commit 8fce7801bb3218f39f2582dfa2cd477a6c2b39c0
Showing with 12 additions and 1 deletion.
  1. +12 −1 src/app/qgsfieldcalculator.cpp
@@ -24,26 +24,37 @@ QgsFieldCalculator::QgsFieldCalculator( QgsVectorLayer* vl ): QDialog(), mVector
{
setupUi( this );

if ( !vl )
{
return;
}

populateFields();
populateOutputFieldTypes();

//default values for field width and precision
mOuputFieldWidthSpinBox->setValue( 10 );
mOutputFieldPrecisionSpinBox->setValue( 3 );

mUpdateExistingFieldCheckBox->setCheckState( Qt::Checked );


//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->setCheckState( Qt::Checked );
mUpdateExistingFieldCheckBox->setEnabled( false ); // must stay checked
mNewFieldGroupBox->setEnabled( false );
mNewFieldGroupBox->setTitle( mNewFieldGroupBox->title() + tr( " (not supported by provider)" ) );
}

if ( vl->selectedFeaturesIds().size() > 0 )
{
mOnlyUpdateSelectedCheckBox->setChecked( true );
}

if ( vl->geometryType() != QGis::Polygon )
{
mAreaButton->setEnabled( false );

0 comments on commit 8fce780

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