Skip to content

Commit 097b7c8

Browse files
author
mhugent
committed
Added new edit type for attributes that are not recommended to change
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10949 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 32ed67a commit 097b7c8

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/app/qgsattributedialog.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,15 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
238238

239239
case QgsVectorLayer::LineEdit:
240240
case QgsVectorLayer::UniqueValuesEditable:
241+
case QgsVectorLayer::Immutable:
241242
default:
242243
{
243244
QLineEdit *le = new QLineEdit( myFieldValue.toString() );
244245

246+
if ( editType == QgsVectorLayer::Immutable)
247+
{
248+
le->setEnabled(false);
249+
}
245250
if ( editType == QgsVectorLayer::UniqueValuesEditable )
246251
{
247252
QList<QVariant> values;

src/app/qgsvectorlayerproperties.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ void QgsVectorLayerProperties::setRow( int row, int idx, const QgsField &field )
189189
cb->addItem( tr( "range (slider)" ), QgsVectorLayer::SliderRange );
190190
cb->addItem( tr( "file name" ), QgsVectorLayer::FileName );
191191
cb->addItem( tr( "enumeration" ), QgsVectorLayer::Enumeration);
192+
cb->addItem( tr( "immutable" ), QgsVectorLayer::Immutable);
192193
cb->setSizeAdjustPolicy( QComboBox::AdjustToContentsOnFirstShow );
193194
cb->setCurrentIndex( layer->editType( idx ) );
194195

src/core/qgsvectorlayer.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
7474
EditRange,
7575
SliderRange,
7676
FileName,
77-
Enumeration
77+
Enumeration,
78+
Immutable /*The attribute value should not be changed in the attribute form*/
7879
};
7980

8081
struct RangeData

0 commit comments

Comments
 (0)