@@ -15,6 +15,7 @@ class QgsAttributeEditorElement : QObject
15
15
{
16
16
AeTypeContainer,
17
17
AeTypeField,
18
+ AeTypeRelation,
18
19
AeTypeInvalid
19
20
};
20
21
@@ -41,6 +42,7 @@ class QgsAttributeEditorContainer : QgsAttributeEditorElement
41
42
42
43
virtual QDomElement toDomElement( QDomDocument& doc ) const;
43
44
virtual void addChildElement( QgsAttributeEditorElement *widget );
45
+ virtual bool isGroupBox() const;
44
46
QList<QgsAttributeEditorElement*> children() const;
45
47
};
46
48
@@ -105,19 +107,20 @@ class QgsVectorLayer : QgsMapLayer
105
107
Classification,
106
108
EditRange,
107
109
SliderRange,
108
- CheckBox, /* added in 1.4 */
110
+ CheckBox, /**< @note added in 1.4 */
109
111
FileName,
110
112
Enumeration,
111
- Immutable, /* The attribute value should not be changed in the attribute form */
112
- Hidden, /* The attribute value should not be shown in the attribute form @added in 1.4 */
113
- TextEdit, /* multiline edit @added in 1.4*/
114
- Calendar, /* calendar widget @added in 1.5 */
115
- DialRange, /* dial range @added in 1.5 */
116
- ValueRelation, /* value map from an table @added in 1.8 */
117
- UuidGenerator, /* uuid generator - readonly and automatically intialized @added in 1.9 */
118
- Photo, /* phote widget @added in 1.9 */
119
- WebView, /* webview widget @added in 1.9 */
120
- Color, /* color @added in 1.9 */
113
+ Immutable, /**< The attribute value should not be changed in the attribute form */
114
+ Hidden, /**< The attribute value should not be shown in the attribute form @note added in 1.4 */
115
+ TextEdit, /**< multiline edit @note added in 1.4*/
116
+ Calendar, /**< calendar widget @note added in 1.5 */
117
+ DialRange, /**< dial range @note added in 1.5 */
118
+ ValueRelation, /**< value map from an table @note added in 1.8 */
119
+ UuidGenerator, /**< uuid generator - readonly and automatically intialized @note added in 1.9 */
120
+ Photo, /**< phote widget @note added in 1.9 */
121
+ WebView, /**< webview widget @note added in 1.9 */
122
+ Color, /**< color @note added in 1.9 */
123
+ EditorWidgetV2, /**< modularized edit widgets @note added in 2.1 */
121
124
};
122
125
123
126
/** Types of feature form suppression after feature creation
@@ -418,13 +421,13 @@ class QgsVectorLayer : QgsMapLayer
418
421
* @param theResultFlag will be set to true if a named style is correctly loaded
419
422
* @param loadFromLocalDb if true forces to load from local db instead of datasource one
420
423
*/
421
- virtual QString loadNamedStyle( const QString theURI, bool &theResultFlag, bool loadFromLocalDb );
424
+ virtual QString loadNamedStyle( const QString & theURI, bool &theResultFlag, bool loadFromLocalDb );
422
425
423
426
/**
424
427
* Calls loadNamedStyle( theURI, theResultFlag, false );
425
428
* Retained for backward compatibility
426
429
*/
427
- virtual QString loadNamedStyle( const QString theURI, bool &theResultFlag );
430
+ virtual QString loadNamedStyle( const QString & theURI, bool &theResultFlag );
428
431
429
432
virtual bool applyNamedStyle( QString namedStyle , QString errorMsg );
430
433
@@ -503,10 +506,12 @@ class QgsVectorLayer : QgsMapLayer
503
506
*/
504
507
bool addFeature( QgsFeature& f, bool alsoUpdateExtent = true );
505
508
506
- /** Updates an existing feature
507
- @param f feature to update
508
- @return True in case of success and False in case of error
509
- @note added in 1.8
509
+ /** Updates an existing feature. This method needs to query the datasource
510
+ on every call. Consider using {@link changeAttributeValue()} or
511
+ {@link changeGeometry()} instead.
512
+ @param f Feature to update
513
+ @return True in case of success and False in case of error
514
+ @note Added in 1.8
510
515
*/
511
516
bool updateFeature( QgsFeature &f );
512
517
@@ -561,6 +566,15 @@ class QgsVectorLayer : QgsMapLayer
561
566
@return 0 in case of success*/
562
567
int translateFeature( QgsFeatureId featureId, double dx, double dy );
563
568
569
+ /**Splits parts cut by the given line
570
+ * @param splitLine line that splits the layer features
571
+ * @param topologicalEditing true if topological editing is enabled
572
+ * @return
573
+ * 0 in case of success,
574
+ * 4 if there is a selection but no feature split
575
+ */
576
+ int splitParts( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
577
+
564
578
/**Splits features cut by the given line
565
579
* @param splitLine line that splits the layer features
566
580
* @param topologicalEditing true if topological editing is enabled
@@ -688,26 +702,57 @@ class QgsVectorLayer : QgsMapLayer
688
702
@note added in version 1.2 */
689
703
bool addAttribute( const QgsField &field );
690
704
691
- /**Sets an alias (a display name) for attributes to display in dialogs
692
- @note added in version 1.2*/
705
+ /**
706
+ * Sets an alias (a display name) for attributes to display in dialogs
707
+ * @note added in version 1.2
708
+ */
693
709
void addAttributeAlias( int attIndex, QString aliasString );
694
710
695
- /**Adds a tab (for the attribute editor form) holding groups and fields
696
- @note added in version 1.9*/
711
+ /**
712
+ * Adds a tab (for the attribute editor form) holding groups and fields
713
+ * @note added in version 2.0
714
+ */
697
715
void addAttributeEditorWidget( QgsAttributeEditorElement* data );
698
- /**Returns a list of tabs holding groups and fields
699
- @note added in version 1.9*/
716
+
717
+ /**
718
+ * Get the id for the editor widget used to represent the field at the given index
719
+ *
720
+ * @param fieldIdx The index of the field
721
+ *
722
+ * @return The id for the editor widget or a NULL string if not applicable
723
+ */
724
+ const QString editorWidgetV2( int fieldIdx );
725
+
726
+ /**
727
+ * Get the configuration for the editor widget used to represent the field at the given index
728
+ *
729
+ * @param fieldIdx The index of the field
730
+ *
731
+ * @return The id for the editor widget or a NULL string if not configured
732
+ */
733
+ const QgsEditorWidgetConfig editorWidgetV2Config( int fieldIdx );
734
+
735
+ /**
736
+ * Returns a list of tabs holding groups and fields
737
+ * @note added in version 2.0
738
+ */
700
739
QList< QgsAttributeEditorElement* > &attributeEditorElements();
701
- /**Clears all the tabs for the attribute editor form
702
- @note added in version 1.9*/
740
+ /**
741
+ * Clears all the tabs for the attribute editor form
742
+ * @note added in version 2.0
743
+ */
703
744
void clearAttributeEditorWidgets();
704
745
705
- /**Returns the alias of an attribute name or an empty string if there is no alias
706
- @note added in version 1.2*/
746
+ /**
747
+ * Returns the alias of an attribute name or an empty string if there is no alias
748
+ * @note added in version 1.2
749
+ */
707
750
QString attributeAlias( int attributeIndex ) const;
708
751
709
- /**Convenience function that returns the attribute alias if defined or the field name else
710
- @note added in version 1.2*/
752
+ /**
753
+ * Convenience function that returns the attribute alias if defined or the field name else
754
+ * @note added in version 1.2
755
+ */
711
756
QString attributeDisplayName( int attributeIndex ) const;
712
757
713
758
const QMap< QString, QString >& attributeAliases() const;
@@ -771,6 +816,10 @@ class QgsVectorLayer : QgsMapLayer
771
816
/** set the active layout for the attribute editor for this layer (added in 1.9) */
772
817
void setEditorLayout( EditorLayout editorLayout );
773
818
819
+ void setEditorWidgetV2( int attrIdx, const QString& widgetType );
820
+
821
+ void setEditorWidgetV2Config( int attrIdx, const QMap<QString, QVariant>& config );
822
+
774
823
/** set string representing 'true' for a checkbox (added in 1.4) */
775
824
void setCheckedState( int idx, QString checked, QString notChecked );
776
825
@@ -817,6 +866,14 @@ class QgsVectorLayer : QgsMapLayer
817
866
**/
818
867
ValueRelationData &valueRelation( int idx );
819
868
869
+ /**
870
+ * Get relations, where the foreign key is on this layer
871
+ *
872
+ * @param idx Only get relations, where idx forms part of the foreign key
873
+ * @return A list of relations
874
+ */
875
+ QList<QgsRelation> referencingRelations( int idx );
876
+
820
877
/**access date format
821
878
* @note added in 1.9
822
879
*/
@@ -906,7 +963,7 @@ class QgsVectorLayer : QgsMapLayer
906
963
/* Set the blending mode used for rendering each feature
907
964
* @note added in 2.0
908
965
*/
909
- void setFeatureBlendMode( const QPainter::CompositionMode blendMode );
966
+ void setFeatureBlendMode( const QPainter::CompositionMode & blendMode );
910
967
/* Returns the current blending mode for features
911
968
* @note added in 2.0
912
969
*/
@@ -920,7 +977,12 @@ class QgsVectorLayer : QgsMapLayer
920
977
* @note added in 2.0
921
978
*/
922
979
int layerTransparency() const;
923
-
980
+
981
+ QString metadata();
982
+
983
+ /** @note not available in python bindings */
984
+ // inline QgsGeometryCache* cache();
985
+
924
986
/** Set the Map2pixel simplification threshold for fast rendering of features */
925
987
void setSimplifyDrawingTol( float simplifyDrawingTol );
926
988
/** Returns the Map2pixel simplification threshold for fast rendering of features */
@@ -942,7 +1004,7 @@ class QgsVectorLayer : QgsMapLayer
942
1004
int simplifyDrawingHints() const;
943
1005
944
1006
/** Returns whether the VectorLayer can apply the specified simplification hint */
945
- bool simplifyDrawingCanbeApplied( int simplifyHint ) const;
1007
+ bool simplifyDrawingCanbeApplied( int simplifyHint ) const;
946
1008
947
1009
public slots:
948
1010
/**
@@ -999,11 +1061,6 @@ class QgsVectorLayer : QgsMapLayer
999
1061
@note added in 1.7 */
1000
1062
void checkJoinLayerRemove( QString theLayerId );
1001
1063
1002
- QString metadata();
1003
-
1004
- /** @note not available in python bindings */
1005
- // QgsGeometryCache* cache();
1006
-
1007
1064
/**
1008
1065
* @brief Is called when the cache image is being deleted. Overwrite and use to clean up.
1009
1066
* @note added in 2.0
@@ -1080,6 +1137,8 @@ class QgsVectorLayer : QgsMapLayer
1080
1137
void committedAttributeValuesChanges( const QString& layerId, const QgsChangedAttributesMap& changedAttributesValues );
1081
1138
void committedGeometriesChanges( const QString& layerId, const QgsGeometryMap& changedGeometries );
1082
1139
1140
+ void saveLayerToProject();
1141
+
1083
1142
/** Emitted when the font family defined for labeling layer is not found on system
1084
1143
* @note added in 1.9
1085
1144
*/
@@ -1089,7 +1148,7 @@ class QgsVectorLayer : QgsMapLayer
1089
1148
void rendererChanged();
1090
1149
1091
1150
/** Signal emitted when setFeatureBlendMode() is called */
1092
- void featureBlendModeChanged( const QPainter::CompositionMode blendMode );
1151
+ void featureBlendModeChanged( const QPainter::CompositionMode & blendMode );
1093
1152
1094
1153
/** Signal emitted when setLayerTransparency() is called */
1095
1154
void layerTransparencyChanged( int layerTransparency );
0 commit comments