Skip to content

Commit 7967110

Browse files
authored
Merge pull request #3663 from nyalldawson/clazy3
Clazy qt5 optimisations - round 2
2 parents b4e3101 + 2fab1b8 commit 7967110

File tree

294 files changed

+622
-491
lines changed

Some content is hidden

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

294 files changed

+622
-491
lines changed

python/analysis/vector/qgszonalstatistics.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class QgsZonalStatistics
3131
typedef QFlags<QgsZonalStatistics::Statistic> Statistics;
3232

3333
QgsZonalStatistics( QgsVectorLayer* polygonLayer, const QString& rasterFile, const QString& attributePrefix = "", int rasterBand = 1,
34-
const QgsZonalStatistics::Statistics& stats = QgsZonalStatistics::Statistics( QgsZonalStatistics::Count | QgsZonalStatistics::Sum | QgsZonalStatistics::Mean) );
34+
QgsZonalStatistics::Statistics stats = QgsZonalStatistics::Statistics( QgsZonalStatistics::Count | QgsZonalStatistics::Sum | QgsZonalStatistics::Mean) );
3535

3636
/** Starts the calculation
3737
@return 0 in case of success*/

python/core/auth/qgsauthmethod.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class QgsAuthMethod : QObject
105105
void setVersion( int version );
106106

107107
/** Set the support expansions (points in providers where the authentication is injected) of the auth method */
108-
void setExpansions( const QgsAuthMethod::Expansions& expansions );
108+
void setExpansions( QgsAuthMethod::Expansions expansions );
109109
/** Set list of data providers this auth method supports */
110110
void setDataProviders( const QStringList& dataproviders );
111111
};

python/core/composer/qgscomposermapgrid.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ class QgsComposerMapGrid : QgsComposerMapItem
684684
* @see frameSideFlags
685685
* @see testFrameSideFlag
686686
*/
687-
void setFrameSideFlags( const FrameSideFlags& flags );
687+
void setFrameSideFlags( FrameSideFlags flags );
688688

689689
/** Sets whether the grid frame is drawn for a certain side of the map item.
690690
* @param flag flag for grid frame side

python/core/composer/qgscomposernodesitem.sip

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ class QgsComposerNodesItem: QgsComposerItem
55
%End
66
public:
77

8-
QgsComposerNodesItem( QString mTagName, QgsComposition* c );
9-
QgsComposerNodesItem( QString mTagName, QPolygonF polygon, QgsComposition* c );
8+
QgsComposerNodesItem( const QString& mTagName, QgsComposition* c );
9+
QgsComposerNodesItem( const QString& mTagName, const QPolygonF& polygon, QgsComposition* c );
1010
~QgsComposerNodesItem();
1111

1212
/** Add a node in current shape.
@@ -16,7 +16,7 @@ class QgsComposerNodesItem: QgsComposerItem
1616
* true. Typically, if this flag is true, the new node has to be nearest
1717
* than radius to the shape to be added.
1818
*/
19-
bool addNode( const QPointF &pt, const bool checkArea = true, const double radius = 10 );
19+
bool addNode( QPointF pt, const bool checkArea = true, const double radius = 10 );
2020

2121
/** Set a tag to indicate if we want to draw or not the shape's nodes.
2222
* @param display
@@ -27,7 +27,7 @@ class QgsComposerNodesItem: QgsComposerItem
2727
* @param index the index of the node to move
2828
* @param node is the new position in scene coordinate
2929
*/
30-
bool moveNode( const int index, const QPointF &node );
30+
bool moveNode( const int index, QPointF node );
3131

3232
/** \brief Reimplementation of QCanvasItem::paint - draw on canvas */
3333
void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
@@ -85,7 +85,7 @@ class QgsComposerNodesItem: QgsComposerItem
8585
protected:
8686

8787
/** Method called in addNode. */
88-
virtual bool _addNode( const int nodeIndex, const QPointF &newPoint, const double radius ) = 0;
88+
virtual bool _addNode( const int nodeIndex, QPointF newPoint, const double radius ) = 0;
8989

9090
/** Method called in removeNode. */
9191
virtual bool _removeNode( const int nodeIndex ) = 0;
@@ -104,7 +104,7 @@ class QgsComposerNodesItem: QgsComposerItem
104104
void rescaleToFitBoundingBox();
105105

106106
/** Compute an euclidian distance between 2 nodes. */
107-
double computeDistance(const QPointF &pt1, const QPointF &pt2) const;
107+
double computeDistance( QPointF pt1, QPointF pt2) const;
108108

109109
/** Update the current scene rectangle for this item. */
110110
void updateSceneRect();

python/core/composer/qgscomposerpolygon.sip

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class QgsComposerPolygon: QgsComposerNodesItem
66
public:
77

88
QgsComposerPolygon( QgsComposition* c );
9-
QgsComposerPolygon( QPolygonF polygon, QgsComposition* c );
9+
QgsComposerPolygon( const QPolygonF& polygon, QgsComposition* c );
1010
~QgsComposerPolygon();
1111

1212
/** Overridden to return shape name */
@@ -23,7 +23,7 @@ class QgsComposerPolygon: QgsComposerNodesItem
2323

2424
protected:
2525

26-
bool _addNode( const int indexPoint, const QPointF &newPoint, const double radius );
26+
bool _addNode( const int indexPoint, QPointF newPoint, const double radius );
2727

2828
bool _removeNode( const int indexPoint );
2929

python/core/composer/qgscomposerpolyline.sip

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class QgsComposerPolyline: QgsComposerNodesItem
66
public:
77

88
QgsComposerPolyline( QgsComposition* c );
9-
QgsComposerPolyline( QPolygonF polyline, QgsComposition* c );
9+
QgsComposerPolyline( const QPolygonF& polyline, QgsComposition* c );
1010
~QgsComposerPolyline();
1111

1212
/** Overridden to return shape name */
@@ -23,7 +23,7 @@ class QgsComposerPolyline: QgsComposerNodesItem
2323

2424
protected:
2525

26-
bool _addNode( const int indexPoint, const QPointF &newPoint, const double radius );
26+
bool _addNode( const int indexPoint, QPointF newPoint, const double radius );
2727

2828
bool _removeNode( const int indexPoint );
2929

python/core/dxf/qgsdxfexport.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,6 @@ class QgsDxfExport
301301
* @param fid id of feature
302302
* @param layer dxf layer of feature
303303
*/
304-
void registerDxfLayer( QString layerId, QgsFeatureId fid, QString layer );
304+
void registerDxfLayer( const QString& layerId, QgsFeatureId fid, const QString& layer );
305305

306306
};

python/core/layertree/qgslayertreemodel.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class QgsLayerTreeModel : QAbstractItemModel
6565
typedef QFlags<QgsLayerTreeModel::Flag> Flags;
6666

6767
//! Set OR-ed combination of model flags
68-
void setFlags( const Flags& f );
68+
void setFlags( Flags f );
6969
//! Enable or disable a model flag
7070
void setFlag( Flag f, bool on = true );
7171
//! Return OR-ed combination of model flags

python/core/qgsattributetableconfig.sip

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class QgsAttributeTableConfig
107107
/**
108108
* Set the style of the action widget
109109
*/
110-
void setActionWidgetStyle( const ActionWidgetStyle& actionWidgetStyle );
110+
void setActionWidgetStyle( ActionWidgetStyle actionWidgetStyle );
111111

112112
/**
113113
* Serialize to XML on layer save
@@ -165,5 +165,5 @@ class QgsAttributeTableConfig
165165
* Set the sort order
166166
* @note Added in 2.16
167167
*/
168-
void setSortOrder( const Qt::SortOrder& sortOrder );
168+
void setSortOrder( Qt::SortOrder sortOrder );
169169
};

python/core/qgsdataitem.sip

+5-5
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ class QgsDataItem : QObject
160160
typedef QFlags<QgsDataItem::Capability> Capabilities;
161161

162162
// This will _write_ selected crs in data source
163-
virtual bool setCrs( QgsCoordinateReferenceSystem crs );
163+
virtual bool setCrs( const QgsCoordinateReferenceSystem& crs );
164164

165165
// ### QGIS 3 - rename to capabilities()
166166
virtual Capabilities capabilities2() const;
167167

168-
virtual void setCapabilities( const Capabilities& capabilities );
168+
virtual void setCapabilities( Capabilities capabilities );
169169

170170
// static methods
171171

@@ -208,7 +208,7 @@ class QgsDataItem : QObject
208208

209209
protected:
210210
virtual void populate( const QVector<QgsDataItem*>& children );
211-
virtual void refresh( QVector<QgsDataItem*> children );
211+
virtual void refresh( const QVector<QgsDataItem*>& children );
212212
/** The item is scheduled to be deleted. E.g. if deleteLater() is called when
213213
* item is in Populating state (createChildren() running in another thread),
214214
* the deferredDelete() returns true and item will be deleted once Populating finished.
@@ -378,7 +378,7 @@ class QgsDirectoryItem : QgsDataCollectionItem
378378
// static QVector<QLibrary*> mLibraries;
379379

380380
/** Check if the given path is hidden from the browser model */
381-
static bool hiddenPath( QString path );
381+
static bool hiddenPath( const QString& path );
382382

383383
public slots:
384384
virtual void childrenCreated();
@@ -482,7 +482,7 @@ class QgsZipItem : QgsDataCollectionItem
482482

483483
static QString vsiPrefix( const QString& uri );
484484

485-
static QgsDataItem* itemFromPath( QgsDataItem* parent, QString path, QString name ) /Factory/;
485+
static QgsDataItem* itemFromPath( QgsDataItem* parent, const QString& path, const QString& name ) /Factory/;
486486
//! @note available in python as itemFromFilePath
487487
static QgsDataItem* itemFromPath( QgsDataItem* parent, const QString& filePath, const QString& name, const QString& path ) /Factory,PyName=itemFromFilePath/;
488488

python/core/qgsdatetimestatisticalsummary.sip

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class QgsDateTimeStatisticalSummary
3434
/** Constructor for QgsDateTimeStatisticalSummary
3535
* @param stats flags for statistics to calculate
3636
*/
37-
QgsDateTimeStatisticalSummary( const QgsDateTimeStatisticalSummary::Statistics& stats = All );
37+
QgsDateTimeStatisticalSummary( QgsDateTimeStatisticalSummary::Statistics stats = All );
3838

3939
/** Returns flags which specify which statistics will be calculated. Some statistics
4040
* are always calculated (eg count).
@@ -47,7 +47,7 @@ class QgsDateTimeStatisticalSummary
4747
* @param stats flags for statistics to calculate
4848
* @see statistics
4949
*/
50-
void setStatistics( const Statistics& stats );
50+
void setStatistics( Statistics stats );
5151

5252
/** Resets the calculated values
5353
*/

python/core/qgsinterval.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class QgsInterval
124124
*/
125125
void setValid( bool valid );
126126

127-
bool operator==( const QgsInterval& other ) const;
127+
bool operator==( QgsInterval other ) const;
128128

129129
/** Converts a string to an interval
130130
* @param string string to parse

python/core/qgsmaplayerdependency.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class QgsMapLayerDependency
1919
};
2020

2121
//! Standard constructor
22-
QgsMapLayerDependency( QString layerId, Type type = DataDependency, Origin origin = FromUser );
22+
QgsMapLayerDependency( const QString& layerId, Type type = DataDependency, Origin origin = FromUser );
2323

2424
//! Return the dependency type
2525
Type type() const;

python/core/qgsmaplayerproxymodel.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class QgsMapLayerProxyModel : QSortFilterProxyModel
4141
* @param filters are Filter flags
4242
* @note added in 2.3
4343
*/
44-
QgsMapLayerProxyModel* setFilters( const Filters& filters );
44+
QgsMapLayerProxyModel* setFilters( Filters filters );
4545
const Filters& filters() const;
4646

4747
//! offer the possibility to except some layers to be listed

python/core/qgsmaprenderercustompainterjob.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class QgsMapRendererCustomPainterJob : QgsMapRendererJob
3838
* Ideally the "wait for finished" method should not be used at all. The code triggering
3939
* rendering should not need to actively wait for rendering to finish.
4040
*/
41-
void waitForFinishedWithEventLoop( const QEventLoop::ProcessEventsFlags& flags = QEventLoop::AllEvents );
41+
void waitForFinishedWithEventLoop( QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents );
4242

4343
/**
4444
* Render the map synchronously in this thread. The function does not return until the map

python/core/qgsmapsettings.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class QgsMapSettings
122122
typedef QFlags<QgsMapSettings::Flag> Flags;
123123

124124
//! Set combination of flags that will be used for rendering
125-
void setFlags( const Flags& flags );
125+
void setFlags( Flags flags );
126126
//! Enable or disable a particular flag (other flags are not affected)
127127
void setFlag( Flag flag, bool on = true );
128128
//! Return combination of flags used for rendering

python/core/qgsproject.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ class QgsProject : QObject
336336
/**
337337
* Set a list of layers which should not be taken into account on map identification
338338
*/
339-
void setNonIdentifiableLayers( QList<QgsMapLayer*> layers );
339+
void setNonIdentifiableLayers( const QList<QgsMapLayer*>& layers );
340340

341341
/**
342342
* Set a list of layers which should not be taken into account on map identification

python/core/qgsrendercontext.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class QgsRenderContext
3030
/** Set combination of flags that will be used for rendering.
3131
* @note added in QGIS 2.14
3232
*/
33-
void setFlags( const QgsRenderContext::Flags& flags );
33+
void setFlags( QgsRenderContext::Flags flags );
3434

3535
/** Enable or disable a particular flag (other flags are not affected)
3636
* @note added in QGIS 2.14

python/core/qgssnappingconfig.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class QgsSnappingConfig
176176
QgsSnappingConfig::IndividualLayerSettings individualLayerSettings( QgsVectorLayer* vl ) const;
177177

178178
//! set individual layer snappings settings (applied if mode is AdvancedConfiguration)
179-
void setIndividualLayerSettings( QgsVectorLayer* vl, QgsSnappingConfig::IndividualLayerSettings individualLayerSettings );
179+
void setIndividualLayerSettings( QgsVectorLayer* vl, const QgsSnappingConfig::IndividualLayerSettings& individualLayerSettings );
180180

181181
/**
182182
* Compare this configuration to other.

python/core/qgssqlstatement.sip

+5-5
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class QgsSQLStatement
113113
* otherwise the original string.
114114
* @see quotedString(), quotedIdentifier()
115115
*/
116-
static QString quotedIdentifierIfNeeded( QString name );
116+
static QString quotedIdentifierIfNeeded( const QString& name );
117117

118118
/** Remove double quotes from an identifier.
119119
* @see quotedIdentifier()
@@ -340,7 +340,7 @@ class QgsSQLStatement
340340
class NodeFunction : QgsSQLStatement::Node
341341
{
342342
public:
343-
NodeFunction( QString name, QgsSQLStatement::NodeList* args /Transfer/ );
343+
NodeFunction( const QString name, QgsSQLStatement::NodeList* args /Transfer/ );
344344
~NodeFunction();
345345

346346
/** Return function name */
@@ -474,7 +474,7 @@ class QgsSQLStatement
474474
{
475475
public:
476476
NodeJoin( QgsSQLStatement::NodeTableDef* tabledef /Transfer/, QgsSQLStatement::Node* onExpr /Transfer/, QgsSQLStatement::JoinType type );
477-
NodeJoin( QgsSQLStatement::NodeTableDef* tabledef /Transfer/, QList<QString> usingColumns, QgsSQLStatement::JoinType type );
477+
NodeJoin( QgsSQLStatement::NodeTableDef* tabledef /Transfer/, const QList<QString>& usingColumns, QgsSQLStatement::JoinType type );
478478

479479
/** Table definition */
480480
QgsSQLStatement::NodeTableDef* tableDef() const;
@@ -525,13 +525,13 @@ class QgsSQLStatement
525525
NodeSelect( QList<QgsSQLStatement::NodeTableDef*> tableList /Transfer/, QList<QgsSQLStatement::NodeSelectedColumn*> columns /Transfer/, bool distinct );
526526

527527
/** Set joins */
528-
void setJoins( QList<QgsSQLStatement::NodeJoin*> joins /Transfer/ );
528+
void setJoins( const QList<QgsSQLStatement::NodeJoin*>& joins /Transfer/ );
529529
/** Append a join */
530530
void appendJoin( QgsSQLStatement::NodeJoin* join /Transfer/ );
531531
/** Set where clause */
532532
void setWhere( QgsSQLStatement::Node* where /Transfer/ );
533533
/** Set order by columns */
534-
void setOrderBy( QList<QgsSQLStatement::NodeColumnSorted*> orderBy /Transfer/ );
534+
void setOrderBy( const QList<QgsSQLStatement::NodeColumnSorted*>& orderBy /Transfer/ );
535535

536536
/** Return the list of tables */
537537
QList<QgsSQLStatement::NodeTableDef*> tables() const;

python/core/qgsstatisticalsummary.sip

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class QgsStatisticalSummary
4444
/** Constructor for QgsStatisticalSummary
4545
* @param stats flags for statistics to calculate
4646
*/
47-
QgsStatisticalSummary( const QgsStatisticalSummary::Statistics& stats = QgsStatisticalSummary::All );
47+
QgsStatisticalSummary( QgsStatisticalSummary::Statistics stats = QgsStatisticalSummary::All );
4848

4949
virtual ~QgsStatisticalSummary();
5050

@@ -59,7 +59,7 @@ class QgsStatisticalSummary
5959
* @param stats flags for statistics to calculate
6060
* @see statistics
6161
*/
62-
void setStatistics( const QgsStatisticalSummary::Statistics& stats );
62+
void setStatistics( QgsStatisticalSummary::Statistics stats );
6363

6464
/** Resets the calculated values
6565
*/

python/core/qgsstringstatisticalsummary.sip

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class QgsStringStatisticalSummary
3838
/** Constructor for QgsStringStatistics
3939
* @param stats flags for statistics to calculate
4040
*/
41-
QgsStringStatisticalSummary( const QgsStringStatisticalSummary::Statistics& stats = All );
41+
QgsStringStatisticalSummary( QgsStringStatisticalSummary::Statistics stats = All );
4242

4343
/** Returns flags which specify which statistics will be calculated. Some statistics
4444
* are always calculated (eg count).
@@ -51,7 +51,7 @@ class QgsStringStatisticalSummary
5151
* @param stats flags for statistics to calculate
5252
* @see statistics
5353
*/
54-
void setStatistics( const Statistics& stats );
54+
void setStatistics( Statistics stats );
5555

5656
/** Resets the calculated values
5757
*/

python/core/qgsvectorfilewriter.sip

+2-2
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class QgsVectorFileWriter
208208
QgsWkbTypes::Type overrideGeometryType = QgsWkbTypes::Unknown,
209209
bool forceMulti = false,
210210
bool includeZ = false,
211-
QgsAttributeList attributes = QgsAttributeList(),
211+
const QgsAttributeList& attributes = QgsAttributeList(),
212212
FieldValueConverter* fieldValueConverter = nullptr
213213
);
214214

@@ -253,7 +253,7 @@ class QgsVectorFileWriter
253253
QgsWkbTypes::Type overrideGeometryType = QgsWkbTypes::Unknown,
254254
bool forceMulti = false,
255255
bool includeZ = false,
256-
QgsAttributeList attributes = QgsAttributeList(),
256+
const QgsAttributeList& attributes = QgsAttributeList(),
257257
FieldValueConverter* fieldValueConverter = nullptr
258258
);
259259

python/core/qgsvectorlayer.sip

+2-2
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ class QgsVectorLayer : QgsMapLayer
547547
* @see deselect(QgsFeatureId)
548548
* @see selectByExpression()
549549
*/
550-
void modifySelection( QgsFeatureIds selectIds, QgsFeatureIds deselectIds );
550+
void modifySelection( const QgsFeatureIds& selectIds, const QgsFeatureIds& deselectIds );
551551

552552
/** Select not selected features and deselect selected ones */
553553
void invertSelection();
@@ -728,7 +728,7 @@ class QgsVectorLayer : QgsMapLayer
728728
*/
729729
bool writeStyle( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const;
730730

731-
bool writeSld( QDomNode& node, QDomDocument& doc, QString& errorMessage, QgsStringMap& props ) const;
731+
bool writeSld( QDomNode& node, QDomDocument& doc, QString& errorMessage, const QgsStringMap& props ) const;
732732
bool readSld( const QDomNode& node, QString& errorMessage );
733733

734734
/**

python/core/qgsvectorlayereditbuffer.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class QgsVectorLayerEditBuffer : QObject
3131
virtual bool deleteFeatures( const QgsFeatureIds& fid );
3232

3333
/** Change feature's geometry */
34-
virtual bool changeGeometry( QgsFeatureId fid, QgsGeometry geom );
34+
virtual bool changeGeometry( QgsFeatureId fid, const QgsGeometry& geom );
3535

3636
/** Changed an attribute value (but does not commit it) */
3737
virtual bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );

0 commit comments

Comments
 (0)