@@ -118,9 +118,12 @@ class QgsVectorLayer : QgsMapLayer
118
118
{
119
119
GeneratedLayout,
120
120
TabLayout,
121
- UiFileLayout,
121
+ UiFileLayout
122
122
};
123
123
124
+ /**
125
+ * @deprecated Use the editorWidgetV2() system instead
126
+ */
124
127
enum EditType
125
128
{
126
129
LineEdit,
@@ -758,16 +761,38 @@ class QgsVectorLayer : QgsMapLayer
758
761
*
759
762
* @return The id for the editor widget or a NULL string if not applicable
760
763
*/
761
- const QString editorWidgetV2( int fieldIdx );
764
+ const QString editorWidgetV2( int fieldIdx ) const;
765
+
766
+ /**
767
+ * Get the id for the editor widget used to represent the field at the given index
768
+ *
769
+ * @param fieldName The name of the field
770
+ *
771
+ * @return The id for the editor widget or a NULL string if not applicable
772
+ *
773
+ * @note python method name editorWidgetV2ByName
774
+ */
775
+ const QString editorWidgetV2( const QString& fieldName ) const /PyName=editorWidgetV2ByName/;
762
776
763
777
/**
764
778
* Get the configuration for the editor widget used to represent the field at the given index
765
779
*
766
780
* @param fieldIdx The index of the field
767
781
*
768
- * @return The id for the editor widget or a NULL string if not configured
782
+ * @return The configuration for the editor widget or an empty config if the field does not exist
769
783
*/
770
- const QgsEditorWidgetConfig editorWidgetV2Config( int fieldIdx );
784
+ const QgsEditorWidgetConfig editorWidgetV2Config( int fieldIdx ) const;
785
+
786
+ /**
787
+ * Get the configuration for the editor widget used to represent the field at the given index
788
+ *
789
+ * @param fieldName The name of the field
790
+ *
791
+ * @return The configuration for the editor widget or an empty config if the field does not exist
792
+ *
793
+ * @note python method name is editorWidgetV2ConfigByName
794
+ */
795
+ const QgsEditorWidgetConfig editorWidgetV2Config( const QString& fieldName ) const /PyName=editorWidgetV2ConfigByName/;
771
796
772
797
/**
773
798
* Returns a list of tabs holding groups and fields
@@ -841,24 +866,48 @@ class QgsVectorLayer : QgsMapLayer
841
866
*/
842
867
bool rollBack( bool deleteBuffer = true );
843
868
844
- /**get edit type*/
845
- EditType editType( int idx );
869
+ /**
870
+ * Get edit type
871
+ *
872
+ * @deprecated Use @see{editorWidgetV2} instead
873
+ */
874
+ EditType editType( int idx ) /Deprecated/;
846
875
847
- /**set edit type*/
848
- void setEditType( int idx, EditType edit );
876
+ /**
877
+ * Get edit type
878
+ *
879
+ * @deprecated Use @see{setEditorWidgetV2} instead
880
+ */
881
+ void setEditType( int idx, EditType edit ) /Deprecated/;
849
882
850
883
/** get the active layout for the attribute editor for this layer (added in 1.9) */
851
884
EditorLayout editorLayout();
852
885
853
886
/** set the active layout for the attribute editor for this layer (added in 1.9) */
854
887
void setEditorLayout( EditorLayout editorLayout );
855
888
889
+ /**
890
+ * Set the editor widget type for a field
891
+ *
892
+ * @param attrIdx Index of the field
893
+ * @param widgetType Type id of the editor widget to use
894
+ */
856
895
void setEditorWidgetV2( int attrIdx, const QString& widgetType );
857
896
897
+ /**
898
+ * Set the editor widget config for a field
899
+ *
900
+ * @param attrIdx Index of the field
901
+ * @param config The config to set for this field
902
+ */
858
903
void setEditorWidgetV2Config( int attrIdx, const QMap<QString, QVariant>& config );
859
904
860
- /** set string representing 'true' for a checkbox (added in 1.4) */
861
- void setCheckedState( int idx, QString checked, QString notChecked );
905
+ /**
906
+ * Set string representing 'true' for a checkbox (added in 1.4)
907
+ *
908
+ * @deprecated Use @see{setEditorWidgetV2Config} instead
909
+ */
910
+ void setCheckedState( int idx, QString checked, QString notChecked ) /Deprecated/;
862
911
863
912
/** get edit form (added in 1.4) */
864
913
QString editForm();
@@ -886,16 +935,25 @@ class QgsVectorLayer : QgsMapLayer
886
935
/** set python function for edit form initialization (added in 1.4) */
887
936
void setEditFormInit( QString function );
888
937
889
- /**access value map*/
890
- QMap<QString, QVariant> valueMap( int idx );
938
+ /**
939
+ * Access value map
940
+ * @deprecated Use @see{editorWidgetV2Config} instead
941
+ */
942
+ QMap<QString, QVariant> valueMap( int idx ) /Deprecated/;
891
943
892
- /**access range */
944
+ /**
945
+ * Access range widget config data
946
+ *
947
+ * @deprecated Use @see{editorWidgetV2Config} instead
948
+ */
893
949
RangeData range( int idx ) /Deprecated/;
894
950
895
- /**access relations
951
+ /**
952
+ * Access value relation widget data
953
+ *
896
954
* @note added in 1.8
897
- ** /
898
- ValueRelationData valueRelation( int idx ) /Deprecated/ ;
955
+ */
956
+ ValueRelationData valueRelation( int idx );
899
957
900
958
/**
901
959
* Get relations, where the foreign key is on this layer
@@ -905,13 +963,21 @@ class QgsVectorLayer : QgsMapLayer
905
963
*/
906
964
QList<QgsRelation> referencingRelations( int idx );
907
965
908
- /**access date format
966
+ /**
967
+ * Access date format
968
+ *
909
969
* @note added in 1.9
970
+ *
971
+ * @deprecated Use @see{setEditorWdigetV2Config} instead
910
972
*/
911
973
QString dateFormat( int idx ) /Deprecated/;
912
974
913
- /**access widget size for photo and webview widget
975
+ /**
976
+ * Access widget size for photo and webview widget
977
+ *
914
978
* @note added in 1.9
979
+ *
980
+ * @deprecated Use @see{setEditorWdigetV2Config} instead
915
981
*/
916
982
QSize widgetSize( int idx ) /Deprecated/;
917
983
@@ -1110,6 +1176,9 @@ class QgsVectorLayer : QgsMapLayer
1110
1176
/** This signal is emitted when modifications has been done on layer */
1111
1177
void layerModified();
1112
1178
1179
+ /** Is emitted, when layer is checked for modifications. Use for last-minute additions */
1180
+ void beforeModifiedCheck() const;
1181
+
1113
1182
/** Is emitted, when editing on this layer has started*/
1114
1183
void editingStarted();
1115
1184
@@ -1179,6 +1248,27 @@ class QgsVectorLayer : QgsMapLayer
1179
1248
/** Signal emitted when setLayerTransparency() is called */
1180
1249
void layerTransparencyChanged( int layerTransparency );
1181
1250
1251
+ /**
1252
+ * Signal emitted when a new edit command has been started
1253
+ *
1254
+ * @param text Description for this edit command
1255
+ */
1256
+ void editCommandStarted( const QString& text );
1257
+
1258
+ /**
1259
+ * Signal emitted, when an edit command successfully ended
1260
+ * @note This does not mean it is also committed, only that it is written
1261
+ * to the edit buffer. See {@link beforeCommitChanges()}
1262
+ */
1263
+ void editCommandEnded();
1264
+
1265
+ /**
1266
+ * Signal emitted, whan an edit command is destroyed
1267
+ * @note This is not a rollback, it is only related to the current edit command.
1268
+ * See {@link beforeRollBack()}
1269
+ */
1270
+ void editCommandDestroyed();
1271
+
1182
1272
protected:
1183
1273
/** Set the extent */
1184
1274
void setExtent( const QgsRectangle &rect );
0 commit comments