Skip to content

Commit

Permalink
Change default behaviour of field calculator dialog (fixes ticket #2542)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@13046 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Mar 11, 2010
1 parent 57469b4 commit ccb101c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/app/qgsfieldcalculator.cpp
Expand Up @@ -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 );
Expand Down

0 comments on commit ccb101c

Please sign in to comment.