Skip to content

Commit ccb101c

Browse files
author
mhugent
committed
Change default behaviour of field calculator dialog (fixes ticket #2542)
git-svn-id: http://svn.osgeo.org/qgis/trunk@13046 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 57469b4 commit ccb101c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/app/qgsfieldcalculator.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,37 @@ QgsFieldCalculator::QgsFieldCalculator( QgsVectorLayer* vl ): QDialog(), mVector
2424
{
2525
setupUi( this );
2626

27+
if ( !vl )
28+
{
29+
return;
30+
}
31+
2732
populateFields();
2833
populateOutputFieldTypes();
2934

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

34-
mUpdateExistingFieldCheckBox->setCheckState( Qt::Checked );
39+
3540

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

3944
// disable creation of new fields if not supported by data provider
4045
if ( !( vl->dataProvider()->capabilities() & QgsVectorDataProvider::AddAttributes ) )
4146
{
47+
mUpdateExistingFieldCheckBox->setCheckState( Qt::Checked );
4248
mUpdateExistingFieldCheckBox->setEnabled( false ); // must stay checked
4349
mNewFieldGroupBox->setEnabled( false );
4450
mNewFieldGroupBox->setTitle( mNewFieldGroupBox->title() + tr( " (not supported by provider)" ) );
4551
}
4652

53+
if ( vl->selectedFeaturesIds().size() > 0 )
54+
{
55+
mOnlyUpdateSelectedCheckBox->setChecked( true );
56+
}
57+
4758
if ( vl->geometryType() != QGis::Polygon )
4859
{
4960
mAreaButton->setEnabled( false );

0 commit comments

Comments
 (0)