Skip to content

Commit 190c051

Browse files
committedJan 5, 2014
fix most cppcheck warnings and implement suggestions
also update and sync some sip interfaces
1 parent d7237b7 commit 190c051

File tree

140 files changed

+606
-636
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+606
-636
lines changed
 

‎python/core/qgsmaplayer.sip

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class QgsMapLayer : QObject
166166
virtual bool isEditable() const;
167167

168168
/** sets state from Dom document
169-
@param layer_node is Dom node corresponding to ``maplayer'' tag
169+
@param layerElement The Dom element corresponding to ``maplayer'' tag
170170
@note
171171

172172
The Dom node corresponds to a Dom document project file XML element read
@@ -276,9 +276,9 @@ class QgsMapLayer : QObject
276276
* @return a QString with any status messages
277277
* @see also loadDefaultStyle ();
278278
*/
279-
virtual QString loadNamedStyle( const QString theURI, bool & theResultFlag /Out/ );
279+
virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag /Out/ );
280280

281-
virtual bool loadNamedStyleFromDb( const QString db, const QString theURI, QString &qml /Out/ );
281+
virtual bool loadNamedStyleFromDb( const QString &db, const QString &theURI, QString &qml /Out/ );
282282

283283
//TODO edit infos
284284
/**
@@ -321,12 +321,12 @@ class QgsMapLayer : QObject
321321
* @return a QString with any status messages
322322
* @sa saveDefaultStyle()
323323
*/
324-
virtual QString saveNamedStyle( const QString theURI, bool & theResultFlag /Out/ );
324+
virtual QString saveNamedStyle( const QString &theURI, bool &theResultFlag /Out/ );
325325

326-
virtual QString saveSldStyle( const QString theURI, bool & theResultFlag );
327-
virtual QString loadSldStyle( const QString theURI, bool &theResultFlag );
326+
virtual QString saveSldStyle( const QString &theURI, bool &theResultFlag );
327+
virtual QString loadSldStyle( const QString &theURI, bool &theResultFlag );
328328

329-
virtual bool readSld( const QDomNode& node, QString& errorMessage );
329+
virtual bool readSld( const QDomNode &node, QString &errorMessage );
330330

331331
/** Read the symbology for the current layer from the Dom node supplied.
332332
* @param node node that will contain the symbology definition for this layer.
@@ -344,7 +344,7 @@ class QgsMapLayer : QObject
344344
virtual bool writeSymbology( QDomNode &node, QDomDocument& doc, QString& errorMessage ) const = 0;
345345

346346
/** Return pointer to layer's undo stack */
347-
QUndoStack* undoStack();
347+
QUndoStack *undoStack();
348348

349349
/** Get the QImage used for caching render operations
350350
* @note This method was added in QGIS 1.4 **/

‎python/core/qgsvectorlayer.sip

Lines changed: 97 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class QgsAttributeEditorElement : QObject
1515
{
1616
AeTypeContainer,
1717
AeTypeField,
18+
AeTypeRelation,
1819
AeTypeInvalid
1920
};
2021

@@ -41,6 +42,7 @@ class QgsAttributeEditorContainer : QgsAttributeEditorElement
4142

4243
virtual QDomElement toDomElement( QDomDocument& doc ) const;
4344
virtual void addChildElement( QgsAttributeEditorElement *widget );
45+
virtual bool isGroupBox() const;
4446
QList<QgsAttributeEditorElement*> children() const;
4547
};
4648

@@ -105,19 +107,20 @@ class QgsVectorLayer : QgsMapLayer
105107
Classification,
106108
EditRange,
107109
SliderRange,
108-
CheckBox, /* added in 1.4 */
110+
CheckBox, /**< @note added in 1.4 */
109111
FileName,
110112
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 */
121124
};
122125

123126
/** Types of feature form suppression after feature creation
@@ -418,13 +421,13 @@ class QgsVectorLayer : QgsMapLayer
418421
* @param theResultFlag will be set to true if a named style is correctly loaded
419422
* @param loadFromLocalDb if true forces to load from local db instead of datasource one
420423
*/
421-
virtual QString loadNamedStyle( const QString theURI, bool &theResultFlag, bool loadFromLocalDb );
424+
virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag, bool loadFromLocalDb );
422425

423426
/**
424427
* Calls loadNamedStyle( theURI, theResultFlag, false );
425428
* Retained for backward compatibility
426429
*/
427-
virtual QString loadNamedStyle( const QString theURI, bool &theResultFlag );
430+
virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag );
428431

429432
virtual bool applyNamedStyle( QString namedStyle , QString errorMsg );
430433

@@ -503,10 +506,12 @@ class QgsVectorLayer : QgsMapLayer
503506
*/
504507
bool addFeature( QgsFeature& f, bool alsoUpdateExtent = true );
505508

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
510515
*/
511516
bool updateFeature( QgsFeature &f );
512517

@@ -561,6 +566,15 @@ class QgsVectorLayer : QgsMapLayer
561566
@return 0 in case of success*/
562567
int translateFeature( QgsFeatureId featureId, double dx, double dy );
563568

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+
564578
/**Splits features cut by the given line
565579
* @param splitLine line that splits the layer features
566580
* @param topologicalEditing true if topological editing is enabled
@@ -688,26 +702,57 @@ class QgsVectorLayer : QgsMapLayer
688702
@note added in version 1.2 */
689703
bool addAttribute( const QgsField &field );
690704

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+
*/
693709
void addAttributeAlias( int attIndex, QString aliasString );
694710

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+
*/
697715
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+
*/
700739
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+
*/
703744
void clearAttributeEditorWidgets();
704745

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+
*/
707750
QString attributeAlias( int attributeIndex ) const;
708751

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+
*/
711756
QString attributeDisplayName( int attributeIndex ) const;
712757

713758
const QMap< QString, QString >& attributeAliases() const;
@@ -771,6 +816,10 @@ class QgsVectorLayer : QgsMapLayer
771816
/** set the active layout for the attribute editor for this layer (added in 1.9) */
772817
void setEditorLayout( EditorLayout editorLayout );
773818

819+
void setEditorWidgetV2( int attrIdx, const QString& widgetType );
820+
821+
void setEditorWidgetV2Config( int attrIdx, const QMap<QString, QVariant>& config );
822+
774823
/** set string representing 'true' for a checkbox (added in 1.4) */
775824
void setCheckedState( int idx, QString checked, QString notChecked );
776825

@@ -817,6 +866,14 @@ class QgsVectorLayer : QgsMapLayer
817866
**/
818867
ValueRelationData &valueRelation( int idx );
819868

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+
820877
/**access date format
821878
* @note added in 1.9
822879
*/
@@ -906,7 +963,7 @@ class QgsVectorLayer : QgsMapLayer
906963
/* Set the blending mode used for rendering each feature
907964
* @note added in 2.0
908965
*/
909-
void setFeatureBlendMode( const QPainter::CompositionMode blendMode );
966+
void setFeatureBlendMode( const QPainter::CompositionMode &blendMode );
910967
/* Returns the current blending mode for features
911968
* @note added in 2.0
912969
*/
@@ -920,7 +977,12 @@ class QgsVectorLayer : QgsMapLayer
920977
* @note added in 2.0
921978
*/
922979
int layerTransparency() const;
923-
980+
981+
QString metadata();
982+
983+
/** @note not available in python bindings */
984+
// inline QgsGeometryCache* cache();
985+
924986
/** Set the Map2pixel simplification threshold for fast rendering of features */
925987
void setSimplifyDrawingTol( float simplifyDrawingTol );
926988
/** Returns the Map2pixel simplification threshold for fast rendering of features */
@@ -942,7 +1004,7 @@ class QgsVectorLayer : QgsMapLayer
9421004
int simplifyDrawingHints() const;
9431005

9441006
/** Returns whether the VectorLayer can apply the specified simplification hint */
945-
bool simplifyDrawingCanbeApplied( int simplifyHint ) const;
1007+
bool simplifyDrawingCanbeApplied( int simplifyHint ) const;
9461008

9471009
public slots:
9481010
/**
@@ -999,11 +1061,6 @@ class QgsVectorLayer : QgsMapLayer
9991061
@note added in 1.7 */
10001062
void checkJoinLayerRemove( QString theLayerId );
10011063

1002-
QString metadata();
1003-
1004-
/** @note not available in python bindings */
1005-
// QgsGeometryCache* cache();
1006-
10071064
/**
10081065
* @brief Is called when the cache image is being deleted. Overwrite and use to clean up.
10091066
* @note added in 2.0
@@ -1080,6 +1137,8 @@ class QgsVectorLayer : QgsMapLayer
10801137
void committedAttributeValuesChanges( const QString& layerId, const QgsChangedAttributesMap& changedAttributesValues );
10811138
void committedGeometriesChanges( const QString& layerId, const QgsGeometryMap& changedGeometries );
10821139

1140+
void saveLayerToProject();
1141+
10831142
/** Emitted when the font family defined for labeling layer is not found on system
10841143
* @note added in 1.9
10851144
*/
@@ -1089,7 +1148,7 @@ class QgsVectorLayer : QgsMapLayer
10891148
void rendererChanged();
10901149

10911150
/** Signal emitted when setFeatureBlendMode() is called */
1092-
void featureBlendModeChanged( const QPainter::CompositionMode blendMode );
1151+
void featureBlendModeChanged( const QPainter::CompositionMode &blendMode );
10931152

10941153
/** Signal emitted when setLayerTransparency() is called */
10951154
void layerTransparencyChanged( int layerTransparency );

0 commit comments

Comments
 (0)
Please sign in to comment.