Skip to content

Commit 337dabe

Browse files
committed
Swap QSharedPointer to std::shared_ptr
1 parent aed6c73 commit 337dabe

Some content is hidden

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

46 files changed

+64
-87
lines changed

src/app/qgsmaptoolselect.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include <QMouseEvent>
2727
#include <QRect>
2828
#include <QColor>
29-
#include <QScopedPointer>
3029

3130

3231
QgsMapToolSelect::QgsMapToolSelect( QgsMapCanvas* canvas )

src/core/qgsaction.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <QUuid>
2525

2626
#include "qgsexpressioncontext.h"
27+
#include <memory>
2728

2829
class QgsExpressionContextScope;
2930

@@ -189,7 +190,7 @@ class CORE_EXPORT QgsAction
189190
QString mCommand;
190191
bool mCaptureOutput = false;
191192
QSet<QString> mActionScopes;
192-
mutable QSharedPointer<QAction> mAction;
193+
mutable std::shared_ptr<QAction> mAction;
193194
QUuid mId;
194195
};
195196

src/core/qgsexpression.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4325,11 +4325,11 @@ bool QgsExpression::needsGeometry() const
43254325

43264326
void QgsExpression::initGeomCalculator()
43274327
{
4328-
if ( d->mCalc.data() )
4328+
if ( d->mCalc.get() )
43294329
return;
43304330

43314331
// Use planimetric as default
4332-
d->mCalc = QSharedPointer<QgsDistanceArea>( new QgsDistanceArea() );
4332+
d->mCalc = std::shared_ptr<QgsDistanceArea>( new QgsDistanceArea() );
43334333
d->mCalc->setEllipsoidalMode( false );
43344334
}
43354335

@@ -4349,9 +4349,9 @@ void QgsExpression::setGeomCalculator( const QgsDistanceArea *calc )
43494349
{
43504350
detach();
43514351
if ( calc )
4352-
d->mCalc = QSharedPointer<QgsDistanceArea>( new QgsDistanceArea( *calc ) );
4352+
d->mCalc = std::shared_ptr<QgsDistanceArea>( new QgsDistanceArea( *calc ) );
43534353
else
4354-
d->mCalc.clear();
4354+
d->mCalc.reset();
43554355
}
43564356

43574357
bool QgsExpression::prepare( const QgsExpressionContext *context )
@@ -4424,7 +4424,7 @@ QString QgsExpression::dump() const
44244424

44254425
QgsDistanceArea* QgsExpression::geomCalculator()
44264426
{
4427-
return d->mCalc.data();
4427+
return d->mCalc.get();
44284428
}
44294429

44304430
QgsUnitTypes::DistanceUnit QgsExpression::distanceUnits() const

src/core/qgsexpressionprivate.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#define QGSEXPRESSIONPRIVATE_H
1919

2020
#include <QString>
21-
#include <QSharedPointer>
21+
#include <memory>
2222

2323
#include "qgsexpression.h"
2424
#include "qgsdistancearea.h"
@@ -67,7 +67,7 @@ class QgsExpressionPrivate
6767

6868
QString mExp;
6969

70-
QSharedPointer<QgsDistanceArea> mCalc;
70+
std::shared_ptr<QgsDistanceArea> mCalc;
7171
QgsUnitTypes::DistanceUnit mDistanceUnit;
7272
QgsUnitTypes::AreaUnit mAreaUnit;
7373
};

src/core/qgsmaphittest.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
* (at your option) any later version. *
1313
* *
1414
***************************************************************************/
15-
#include <QScopedPointer>
1615

1716
#include "qgsmaphittest.h"
1817

src/core/qgsvectorlayerjoininfo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ class CORE_EXPORT QgsVectorLayerJoinInfo
6666

6767
/** Set subset of fields to be used from joined layer. Takes ownership of the passed pointer. Null pointer tells to use all fields.
6868
@note added in 2.6 */
69-
void setJoinFieldNamesSubset( QStringList* fieldNamesSubset ) { mJoinFieldsSubset = QSharedPointer<QStringList>( fieldNamesSubset ); }
69+
void setJoinFieldNamesSubset( QStringList* fieldNamesSubset ) { mJoinFieldsSubset = std::shared_ptr<QStringList>( fieldNamesSubset ); }
7070

7171
/** Get subset of fields to be used from joined layer. All fields will be used if null is returned.
7272
@note added in 2.6 */
73-
QStringList* joinFieldNamesSubset() const { return mJoinFieldsSubset.data(); }
73+
QStringList* joinFieldNamesSubset() const { return mJoinFieldsSubset.get(); }
7474

7575
protected:
7676
//! Join field in the target layer
@@ -89,7 +89,7 @@ class CORE_EXPORT QgsVectorLayerJoinInfo
8989
bool mMemoryCache;
9090

9191
//! Subset of fields to use from joined layer. null = use all fields
92-
QSharedPointer<QStringList> mJoinFieldsSubset;
92+
std::shared_ptr<QStringList> mJoinFieldsSubset;
9393

9494
// caching support
9595

src/core/symbology-ng/qgscategorizedsymbolrenderer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "qgscolorramp.h"
2323

2424
#include <QHash>
25-
#include <QScopedPointer>
2625

2726
class QgsVectorLayer;
2827

src/core/symbology-ng/qgsgraduatedsymbolrenderer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "qgssymbol.h"
2020
#include "qgsrenderer.h"
2121
#include "qgsexpression.h"
22-
#include <QScopedPointer>
2322
#include <QRegExp>
2423

2524
/** \ingroup core

src/core/symbology-ng/qgsheatmaprenderer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "qgssymbol.h"
2222
#include "qgsexpression.h"
2323
#include "qgsgeometry.h"
24-
#include <QScopedPointer>
2524

2625
class QgsColorRamp;
2726

src/core/symbology-ng/qgsinvertedpolygonrenderer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "qgsexpression.h"
2222
#include "qgsfeature.h"
2323
#include "qgsgeometry.h"
24-
#include <QScopedPointer>
2524

2625
/** \ingroup core
2726
* QgsInvertedPolygonRenderer is a polygon-only feature renderer used to

src/core/symbology-ng/qgssinglesymbolrenderer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "qgsrenderer.h"
2121
#include "qgssymbol.h"
2222
#include "qgsexpression.h"
23-
#include <QScopedPointer>
2423

2524
/** \ingroup core
2625
* \class QgsSingleSymbolRenderer

src/gui/editorwidgets/core/qgseditorwidgetautoconf.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ QgsEditorWidgetSetup QgsEditorWidgetAutoConf::editorWidgetSetup( const QgsVector
104104
}
105105

106106
int bestScore = 0;
107-
Q_FOREACH ( QSharedPointer<QgsEditorWidgetAutoConfPlugin> cur, plugins )
107+
Q_FOREACH ( std::shared_ptr<QgsEditorWidgetAutoConfPlugin> cur, plugins )
108108
{
109109
int score = 0;
110110
const QgsEditorWidgetSetup curResult = cur->editorWidgetSetup( vl, fieldName, score );
@@ -121,6 +121,6 @@ QgsEditorWidgetSetup QgsEditorWidgetAutoConf::editorWidgetSetup( const QgsVector
121121

122122
void QgsEditorWidgetAutoConf::registerPlugin( QgsEditorWidgetAutoConfPlugin* plugin )
123123
{
124-
plugins.append( QSharedPointer<QgsEditorWidgetAutoConfPlugin>( plugin ) );
124+
plugins.append( std::shared_ptr<QgsEditorWidgetAutoConfPlugin>( plugin ) );
125125
}
126126
///@endcond

src/gui/editorwidgets/core/qgseditorwidgetautoconf.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#define QGSEDITORWIDGETAUTOCONF_H
1717

1818
#include <QList>
19-
#include <QSharedPointer>
2019
#include "qgis_gui.h"
20+
#include <memory>
2121

2222
class QgsVectorLayer;
2323
class QgsEditorWidgetSetup;
@@ -85,7 +85,7 @@ class GUI_EXPORT QgsEditorWidgetAutoConf
8585
void registerPlugin( QgsEditorWidgetAutoConfPlugin* plugin );
8686

8787
private:
88-
QList<QSharedPointer<QgsEditorWidgetAutoConfPlugin> > plugins;
88+
QList<std::shared_ptr<QgsEditorWidgetAutoConfPlugin> > plugins;
8989
};
9090
///@endcond
9191

src/gui/qgsdatadefinedbutton.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <QMap>
2121
#include <QPointer>
2222
#include <QToolButton>
23-
#include <QScopedPointer>
2423
#include "qgsexpressioncontextgenerator.h"
2524
#include "qgsproperty.h"
2625
#include "qgis_gui.h"

src/gui/qgsfieldexpressionwidget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void QgsFieldExpressionWidget::setLeftHandButtonStyle( bool isLeft )
9797

9898
void QgsFieldExpressionWidget::setGeomCalculator( const QgsDistanceArea &da )
9999
{
100-
mDa = QSharedPointer<const QgsDistanceArea>( new QgsDistanceArea( da ) );
100+
mDa = std::shared_ptr<const QgsDistanceArea>( new QgsDistanceArea( da ) );
101101
}
102102

103103
QString QgsFieldExpressionWidget::currentText() const
@@ -211,7 +211,7 @@ void QgsFieldExpressionWidget::editExpression()
211211
QgsExpressionContext context = mExpressionContextGenerator ? mExpressionContextGenerator->createExpressionContext() : mExpressionContext;
212212

213213
QgsExpressionBuilderDialog dlg( vl, currentExpression, this, QStringLiteral( "generic" ), context );
214-
if ( !mDa.isNull() )
214+
if ( mDa )
215215
{
216216
dlg.setGeomCalculator( *mDa );
217217
}

src/gui/qgsfieldexpressionwidget.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
#ifndef QGSFIELDEXPRESSIONWIDGET_H
1717
#define QGSFIELDEXPRESSIONWIDGET_H
1818

19-
#include <QSharedPointer>
2019
#include <QWidget>
2120
#include <QToolButton>
2221
#include <QComboBox>
2322
#include <QColor>
23+
#include <memory>
2424

2525
#include "qgsdistancearea.h"
2626
#include "qgsfieldproxymodel.h"
@@ -193,7 +193,7 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
193193
QToolButton* mButton;
194194
QgsFieldProxyModel* mFieldProxyModel;
195195
QString mExpressionDialogTitle;
196-
QSharedPointer<const QgsDistanceArea> mDa;
196+
std::shared_ptr<const QgsDistanceArea> mDa;
197197
QgsExpressionContext mExpressionContext;
198198
const QgsExpressionContextGenerator* mExpressionContextGenerator;
199199
QString mBackupExpression;

src/gui/qgspropertyoverridebutton.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <QMap>
2222
#include <QPointer>
2323
#include <QToolButton>
24-
#include <QScopedPointer>
2524
#include "qgsproperty.h"
2625
#include "qgspropertycollection.h"
2726
#include "qgsexpressioncontext.h"

src/gui/symbology-ng/qgssymbolselectordialog.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "qgsproperty.h"
2626

2727
#include <QStandardItemModel>
28-
#include <QScopedPointer>
2928
#include <QDialogButtonBox>
3029
#include "qgis_gui.h"
3130

src/gui/symbology-ng/qgssymbolslistwidget.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
#include <QMessageBox>
4242
#include <QMenu>
4343
#include <QPushButton>
44-
#include <QScopedPointer>
4544

4645

4746
QgsSymbolsListWidget::QgsSymbolsListWidget( QgsSymbol* symbol, QgsStyle* style, QMenu* menu, QWidget* parent, const QgsVectorLayer * layer )

src/providers/postgres/qgspostgresfeatureiterator.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include "qgsfeatureiterator.h"
1919

2020
#include <QQueue>
21-
#include <QSharedPointer>
2221

2322
#include "qgspostgresprovider.h"
2423

@@ -53,7 +52,7 @@ class QgsPostgresFeatureSource : public QgsAbstractFeatureSource
5352
QString mQuery;
5453
// TODO: loadFields()
5554

56-
QSharedPointer<QgsPostgresSharedData> mShared;
55+
std::shared_ptr<QgsPostgresSharedData> mShared;
5756

5857
/* The transaction connection (if any) gets refed/unrefed when creating/
5958
* destroying the QgsPostgresFeatureSource, to ensure that the transaction

src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ QString QgsPostgresProvider::whereClause( QgsFeatureId featureId ) const
467467
}
468468

469469

470-
QString QgsPostgresUtils::whereClause( QgsFeatureId featureId, const QgsFields& fields, QgsPostgresConn* conn, QgsPostgresPrimaryKeyType pkType, const QList<int>& pkAttrs, QSharedPointer<QgsPostgresSharedData> sharedData )
470+
QString QgsPostgresUtils::whereClause( QgsFeatureId featureId, const QgsFields& fields, QgsPostgresConn* conn, QgsPostgresPrimaryKeyType pkType, const QList<int>& pkAttrs, std::shared_ptr<QgsPostgresSharedData> sharedData )
471471
{
472472
QString whereClause;
473473

@@ -532,7 +532,7 @@ QString QgsPostgresUtils::whereClause( QgsFeatureId featureId, const QgsFields&
532532
return whereClause;
533533
}
534534

535-
QString QgsPostgresUtils::whereClause( const QgsFeatureIds& featureIds, const QgsFields& fields, QgsPostgresConn* conn, QgsPostgresPrimaryKeyType pkType, const QList<int>& pkAttrs, QSharedPointer<QgsPostgresSharedData> sharedData )
535+
QString QgsPostgresUtils::whereClause( const QgsFeatureIds& featureIds, const QgsFields& fields, QgsPostgresConn* conn, QgsPostgresPrimaryKeyType pkType, const QList<int>& pkAttrs, std::shared_ptr<QgsPostgresSharedData> sharedData )
536536
{
537537
switch ( pkType )
538538
{

src/providers/postgres/qgspostgresprovider.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "qgsvectorlayerimport.h"
2424
#include "qgspostgresconn.h"
2525
#include "qgsfields.h"
26-
#include <QSharedPointer>
26+
#include <memory>
2727

2828
class QgsFeature;
2929
class QgsField;
@@ -337,7 +337,7 @@ class QgsPostgresProvider : public QgsVectorDataProvider
337337
QString mDetectedSrid; //! Spatial reference detected in the database
338338
QString mRequestedSrid; //! Spatial reference requested in the uri
339339

340-
QSharedPointer<QgsPostgresSharedData> mShared; //!< Mutable data shared between provider and feature sources
340+
std::shared_ptr<QgsPostgresSharedData> mShared; //!< Mutable data shared between provider and feature sources
341341

342342
bool getGeometryDetails();
343343

@@ -419,14 +419,14 @@ class QgsPostgresUtils
419419
QgsPostgresConn* conn,
420420
QgsPostgresPrimaryKeyType pkType,
421421
const QList<int>& pkAttrs,
422-
QSharedPointer<QgsPostgresSharedData> sharedData );
422+
std::shared_ptr<QgsPostgresSharedData> sharedData );
423423

424424
static QString whereClause( const QgsFeatureIds& featureIds,
425425
const QgsFields& fields,
426426
QgsPostgresConn* conn,
427427
QgsPostgresPrimaryKeyType pkType,
428428
const QList<int>& pkAttrs,
429-
QSharedPointer<QgsPostgresSharedData> sharedData );
429+
std::shared_ptr<QgsPostgresSharedData> sharedData );
430430

431431
static QString andWhereClauses( const QString& c1, const QString& c2 );
432432

src/providers/wfs/qgswfsfeatureiterator.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "qgsgml.h"
2323
#include "qgsspatialindex.h"
2424

25+
#include <memory>
2526
#include <QProgressDialog>
2627
#include <QPushButton>
2728

@@ -217,7 +218,7 @@ class QgsWFSFeatureIterator : public QObject,
217218
//! Copies feature attributes / geometry from srcFeature to dstFeature
218219
void copyFeature( const QgsFeature& srcFeature, QgsFeature& dstFeature );
219220

220-
QSharedPointer<QgsWFSSharedData> mShared; //!< Mutable data shared between provider and feature sources
221+
std::shared_ptr<QgsWFSSharedData> mShared; //!< Mutable data shared between provider and feature sources
221222

222223
//! Subset of attributes (relatives to mShared->mFields) to fetch. Only valid if ( mRequest.flags() & QgsFeatureRequest::SubsetOfAttributes )
223224
QgsAttributeList mSubSetAttributes;
@@ -256,7 +257,7 @@ class QgsWFSFeatureSource : public QgsAbstractFeatureSource
256257

257258
protected:
258259

259-
QSharedPointer<QgsWFSSharedData> mShared; //!< Mutable data shared between provider and feature sources
260+
std::shared_ptr<QgsWFSSharedData> mShared; //!< Mutable data shared between provider and feature sources
260261

261262
friend class QgsWFSFeatureIterator;
262263
};

src/providers/wfs/qgswfsprovider.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ QgsWFSProvider::QgsWFSProvider( const QString& uri, const QgsWfsCapabilities::Ca
5959
, mCapabilities( 0 )
6060
{
6161
mShared->mCaps = caps;
62-
connect( mShared.data(), SIGNAL( raiseError( const QString& ) ), this, SLOT( pushErrorSlot( const QString& ) ) );
63-
connect( mShared.data(), SIGNAL( extentUpdated() ), this, SIGNAL( fullExtentCalculated() ) );
62+
connect( mShared.get(), SIGNAL( raiseError( const QString& ) ), this, SLOT( pushErrorSlot( const QString& ) ) );
63+
connect( mShared.get(), SIGNAL( extentUpdated() ), this, SIGNAL( fullExtentCalculated() ) );
6464

6565
if ( uri.isEmpty() )
6666
{
@@ -120,7 +120,7 @@ QgsWFSProvider::QgsWFSProvider( const QString& uri, const QgsWfsCapabilities::Ca
120120
//Failed to detect feature type from describeFeatureType -> get first feature from layer to detect type
121121
if ( mWKBType == QgsWkbTypes::Unknown )
122122
{
123-
QgsWFSFeatureDownloader downloader( mShared.data() );
123+
QgsWFSFeatureDownloader downloader( mShared.get() );
124124
connect( &downloader, SIGNAL( featureReceived( QVector<QgsWFSFeatureGmlIdPair> ) ),
125125
this, SLOT( featureReceivedAnalyzeOneFeature( QVector<QgsWFSFeatureGmlIdPair> ) ) );
126126
downloader.run( false, /* serialize features */

src/providers/wfs/qgswfsprovider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class QgsWFSProvider : public QgsVectorDataProvider
122122

123123
private:
124124
//! Mutable data shared between provider and feature sources
125-
QSharedPointer<QgsWFSSharedData> mShared;
125+
std::shared_ptr<QgsWFSSharedData> mShared;
126126

127127
friend class QgsWFSFeatureSource;
128128

src/server/qgsserver.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
#include <QImage>
4747
#include <QSettings>
4848
#include <QDateTime>
49-
#include <QScopedPointer>
5049

5150
// TODO: remove, it's only needed by a single debug message
5251
#include <fcgi_stdio.h>

0 commit comments

Comments
 (0)