Skip to content
Permalink
Browse files

fix editable attribute of joined fields (fix #7739)

Based on pull request 576 by minorua
  • Loading branch information
m-kuhn committed Jul 3, 2013
1 parent 67b8ee4 commit d2b2bb18699c49a7eddfdd7644933e3e82cd42ea
@@ -109,6 +109,11 @@ void QgsAttributeTypeDialog::setFieldEditable( bool editable )
isFieldEditableCheckBox->setChecked( editable );
}

void QgsAttributeTypeDialog::setFieldEditableEnabled( bool enabled )
{
isFieldEditableCheckBox->setEnabled( enabled );
}

void QgsAttributeTypeDialog::setLabelOnTop( bool onTop )
{
labelOnTopCheckBox->setChecked( onTop );
@@ -100,6 +100,13 @@ class QgsAttributeTypeDialog: public QDialog, private Ui::QgsAttributeTypeDialog
*/
void setFieldEditable( bool editable );

/**
* Sets the enabled state of the "editable" checkbox
*
* @param enabled sets the enabled state of the checkbox
*/
void setFieldEditableEnabled( bool enabled );

/**
* Setter for checkbox to label on top
* @param bool onTop
@@ -494,6 +494,7 @@ void QgsFieldsProperties::attributeTypeDialog()
attributeTypeDialog.setLabelOnTop( cfg.mLabelOnTop );

attributeTypeDialog.setIndex( index, cfg.mEditType );
attributeTypeDialog.setFieldEditableEnabled( cfg.mEditableEnabled );

if ( !attributeTypeDialog.exec() )
return;
@@ -930,6 +931,7 @@ QgsFieldsProperties::FieldConfig::FieldConfig( QgsVectorLayer* layer, int idx )
: mButton( NULL )
{
mEditable = layer->fieldEditable( idx );
mEditableEnabled = layer->pendingFields().fieldOrigin( idx ) != QgsFields::OriginJoin;
mLabelOnTop = layer->labelOnTop( idx );
mValueRelationData = layer->valueRelation( idx );
mValueMap = layer->valueMap( idx );
@@ -54,6 +54,7 @@ class QgsFieldsProperties : public QWidget, private Ui_QgsFieldsPropertiesBase
FieldConfig( QgsVectorLayer* layer, int idx );

bool mEditable;
bool mEditableEnabled;
bool mLabelOnTop;
QgsVectorLayer::ValueRelationData mValueRelationData;
QMap<QString, QVariant> mValueMap;
@@ -954,6 +954,7 @@ void QgsVectorLayerProperties::on_mButtonAddJoin_clicked()
pbnQueryBuilder->setEnabled( layer && layer->dataProvider() && layer->dataProvider()->supportsSubsetString() &&
!layer->isEditable() && layer->vectorJoins().size() < 1 );
}
mFieldsPropertiesDialog->init();
}
}

@@ -995,6 +996,7 @@ void QgsVectorLayerProperties::on_mButtonRemoveJoin_clicked()
mJoinTreeWidget->takeTopLevelItem( mJoinTreeWidget->indexOfTopLevelItem( currentJoinItem ) );
pbnQueryBuilder->setEnabled( layer && layer->dataProvider() && layer->dataProvider()->supportsSubsetString() &&
!layer->isEditable() && layer->vectorJoins().size() < 1 );
mFieldsPropertiesDialog->init();
}


@@ -3083,7 +3083,11 @@ bool QgsVectorLayer::fieldEditable( int idx )
{
const QgsFields &fields = pendingFields();
if ( idx >= 0 && idx < fields.count() )
{
if ( mUpdatedFields.fieldOrigin( idx ) == QgsFields::OriginJoin )
return false;
return mFieldEditables.value( fields[idx].name(), true );
}
else
return true;
}

0 comments on commit d2b2bb1

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