Followup 320c696 use clang-modernize to replace 0/NULL use with nullptr

This commit is contained in:
Nyall Dawson 2015-12-14 11:21:07 +11:00
parent fb2b930db8
commit 576875e998
1071 changed files with 5127 additions and 5127 deletions

View File

@ -20,7 +20,7 @@
#include <qmath.h> #include <qmath.h>
CloughTocherInterpolator::CloughTocherInterpolator() CloughTocherInterpolator::CloughTocherInterpolator()
: mTIN( 0 ) : mTIN( nullptr )
, mEdgeTolerance( 0.00001 ) , mEdgeTolerance( 0.00001 )
, der1X( 0.0 ) , der1X( 0.0 )
, der1Y( 0.0 ) , der1Y( 0.0 )

View File

@ -930,7 +930,7 @@ QList<int>* DualEdgeTriangulation::getSurroundingTriangles( int pointno )
if ( firstedge == -1 )//an error occured if ( firstedge == -1 )//an error occured
{ {
return 0; return nullptr;
} }
QList<int>* vlist = new QList<int>();//create the value list on the heap QList<int>* vlist = new QList<int>();//create the value list on the heap
@ -3070,13 +3070,13 @@ QList<int>* DualEdgeTriangulation::getPointsAroundEdge( double x, double y )
else else
{ {
QgsDebugMsg( "warning: null pointer" ); QgsDebugMsg( "warning: null pointer" );
return 0; return nullptr;
} }
} }
else else
{ {
QgsDebugMsg( "Edge number negative" ); QgsDebugMsg( "Edge number negative" );
return 0; return nullptr;
} }
} }
@ -3102,7 +3102,7 @@ bool DualEdgeTriangulation::saveAsShapefile( const QString& fileName ) const
} }
} }
QgsVectorFileWriter writer( shapeFileName, "Utf-8", fields, QGis::WKBLineString, 0 ); QgsVectorFileWriter writer( shapeFileName, "Utf-8", fields, QGis::WKBLineString, nullptr );
if ( writer.hasError() != QgsVectorFileWriter::NoError ) if ( writer.hasError() != QgsVectorFileWriter::NoError )
{ {
return false; return false;

View File

@ -181,7 +181,7 @@ inline DualEdgeTriangulation::DualEdgeTriangulation()
, xMin( 0 ) , xMin( 0 )
, yMax( 0 ) , yMax( 0 )
, yMin( 0 ) , yMin( 0 )
, mTriangleInterpolator( 0 ) , mTriangleInterpolator( nullptr )
, mForcedCrossBehaviour( Triangulation::DELETE_FIRST ) , mForcedCrossBehaviour( Triangulation::DELETE_FIRST )
, mEdgeColor( 0, 255, 0 ) , mEdgeColor( 0, 255, 0 )
, mForcedEdgeColor( 0, 0, 255 ) , mForcedEdgeColor( 0, 0, 255 )
@ -202,7 +202,7 @@ inline DualEdgeTriangulation::DualEdgeTriangulation( int nop, Triangulation* dec
, xMin( 0 ) , xMin( 0 )
, yMax( 0 ) , yMax( 0 )
, yMin( 0 ) , yMin( 0 )
, mTriangleInterpolator( 0 ) , mTriangleInterpolator( nullptr )
, mForcedCrossBehaviour( Triangulation::DELETE_FIRST ) , mForcedCrossBehaviour( Triangulation::DELETE_FIRST )
, mEdgeColor( 0, 255, 0 ) , mEdgeColor( 0, 255, 0 )
, mForcedEdgeColor( 0, 0, 255 ) , mForcedEdgeColor( 0, 0, 255 )

View File

@ -49,7 +49,7 @@ class ANALYSIS_EXPORT LinTriangleInterpolator : public TriangleInterpolator
}; };
inline LinTriangleInterpolator::LinTriangleInterpolator() inline LinTriangleInterpolator::LinTriangleInterpolator()
: mTIN( 0 ) : mTIN( nullptr )
{ {
} }

View File

@ -25,7 +25,7 @@ Node::Node( const Node& n )
} }
else else
{ {
mPoint = 0; mPoint = nullptr;
} }
mNext = n.getNext(); mNext = n.getNext();
@ -39,7 +39,7 @@ Node& Node::operator=( const Node & n )
if ( n.getPoint() )//mPoint of n is not a null pointer if ( n.getPoint() )//mPoint of n is not a null pointer
{ {
mPoint = new Point3D( n.getPoint()->getX(), n.getPoint()->getY(), n.getPoint()->getZ() ); mPoint = new Point3D( n.getPoint()->getX(), n.getPoint()->getY(), n.getPoint()->getZ() );
if ( mPoint == 0 )//no memory if ( mPoint == nullptr )//no memory
{ {
mPoint = tmp; mPoint = tmp;
mNext = n.getNext(); mNext = n.getNext();
@ -49,7 +49,7 @@ Node& Node::operator=( const Node & n )
} }
else//mPoint of n is a null pointer else//mPoint of n is a null pointer
{ {
mPoint = 0; mPoint = nullptr;
} }
if ( tmp ) if ( tmp )

View File

@ -42,7 +42,7 @@ class ANALYSIS_EXPORT Node
void setPoint( Point3D* p ); void setPoint( Point3D* p );
}; };
inline Node::Node() : mPoint( 0 ), mNext( 0 ) inline Node::Node() : mPoint( nullptr ), mNext( nullptr )
{ {
} }

View File

@ -518,7 +518,7 @@ bool NormVecDecorator::estimateFirstDerivatives( QProgressDialog* d )
{ {
d->setMinimum( 0 ); d->setMinimum( 0 );
d->setMaximum( getNumberOfPoints() ); d->setMaximum( getNumberOfPoints() );
d->setCancelButton( 0 ); //we cannot cancel derivative estimation d->setCancelButton( nullptr ); //we cannot cancel derivative estimation
d->show(); d->show();
} }

View File

@ -45,7 +45,7 @@ class ANALYSIS_EXPORT NormVecDecorator: public TriDecorator
/** Estimates the first derivative a point. Return true in case of succes and false otherwise*/ /** Estimates the first derivative a point. Return true in case of succes and false otherwise*/
bool estimateFirstDerivative( int pointno ); bool estimateFirstDerivative( int pointno );
/** This method adds the functionality of estimating normals at the data points. Return true in the case of success and false otherwise*/ /** This method adds the functionality of estimating normals at the data points. Return true in the case of success and false otherwise*/
bool estimateFirstDerivatives( QProgressDialog* d = 0 ); bool estimateFirstDerivatives( QProgressDialog* d = nullptr );
/** Returns a pointer to the normal vector for the point with the number n*/ /** Returns a pointer to the normal vector for the point with the number n*/
Vector3D* getNormal( int n ) const; Vector3D* getNormal( int n ) const;
/** Finds out, in which triangle a point with coordinates x and y is and assigns the triangle points to p1, p2, p3 and the estimated normals to v1, v2, v3. The vectors are normaly taken from 'mNormVec', exept if p1, p2 or p3 is a point on a breakline. In this case, the normal is calculated on-the-fly. Returns false, if something went wrong and true otherwise*/ /** Finds out, in which triangle a point with coordinates x and y is and assigns the triangle points to p1, p2, p3 and the estimated normals to v1, v2, v3. The vectors are normaly taken from 'mNormVec', exept if p1, p2 or p3 is a point on a breakline. In this case, the normal is calculated on-the-fly. Returns false, if something went wrong and true otherwise*/
@ -78,12 +78,12 @@ class ANALYSIS_EXPORT NormVecDecorator: public TriDecorator
void setState( int pointno, pointState s ); void setState( int pointno, pointState s );
}; };
inline NormVecDecorator::NormVecDecorator(): TriDecorator(), mInterpolator( 0 ), mNormVec( new QVector<Vector3D*>( mDefaultStorageForNormals ) ), mPointState( new QVector<pointState>( mDefaultStorageForNormals ) ) inline NormVecDecorator::NormVecDecorator(): TriDecorator(), mInterpolator( nullptr ), mNormVec( new QVector<Vector3D*>( mDefaultStorageForNormals ) ), mPointState( new QVector<pointState>( mDefaultStorageForNormals ) )
{ {
alreadyestimated = false; alreadyestimated = false;
} }
inline NormVecDecorator::NormVecDecorator( Triangulation* tin ): TriDecorator( tin ), mInterpolator( 0 ), mNormVec( new QVector<Vector3D*>( mDefaultStorageForNormals ) ), mPointState( new QVector<pointState>( mDefaultStorageForNormals ) ) inline NormVecDecorator::NormVecDecorator( Triangulation* tin ): TriDecorator( tin ), mInterpolator( nullptr ), mNormVec( new QVector<Vector3D*>( mDefaultStorageForNormals ) ), mPointState( new QVector<pointState>( mDefaultStorageForNormals ) )
{ {
alreadyestimated = false; alreadyestimated = false;
} }
@ -102,7 +102,7 @@ inline Vector3D* NormVecDecorator::getNormal( int n ) const
else else
{ {
QgsDebugMsg( "warning, null pointer" ); QgsDebugMsg( "warning, null pointer" );
return 0; return nullptr;
} }
} }

View File

@ -47,7 +47,7 @@ void ParametricLine::calcPoint( float t, Point3D *p )
ParametricLine* ParametricLine::getParent() const ParametricLine* ParametricLine::getParent() const
{ {
QgsDebugMsg( "warning, derive a class from ParametricLine" ); QgsDebugMsg( "warning, derive a class from ParametricLine" );
return 0; return nullptr;
} }
void ParametricLine::remove( int i ) void ParametricLine::remove( int i )
@ -78,11 +78,11 @@ const Point3D* ParametricLine::getControlPoint( int number ) const
{ {
Q_UNUSED( number ); Q_UNUSED( number );
QgsDebugMsg( "warning, derive a class from ParametricLine" ); QgsDebugMsg( "warning, derive a class from ParametricLine" );
return 0; return nullptr;
} }
const QVector<Point3D*>* ParametricLine::getControlPoly() const const QVector<Point3D*>* ParametricLine::getControlPoly() const
{ {
QgsDebugMsg( "warning, derive a class from ParametricLine" ); QgsDebugMsg( "warning, derive a class from ParametricLine" );
return 0; return nullptr;
} }

View File

@ -58,7 +58,7 @@ class ANALYSIS_EXPORT ParametricLine
//-----------------------------------------constructors and destructor---------------------- //-----------------------------------------constructors and destructor----------------------
inline ParametricLine::ParametricLine() : mDegree( 0 ), mParent( 0 ), mControlPoly( 0 ) inline ParametricLine::ParametricLine() : mDegree( 0 ), mParent( nullptr ), mControlPoly( nullptr )
{ {
} }

View File

@ -93,7 +93,7 @@ Point3D* TriDecorator::getPoint( unsigned int i ) const
else else
{ {
QgsDebugMsg( "warning, null pointer" ); QgsDebugMsg( "warning, null pointer" );
return 0; return nullptr;
} }
} }
@ -162,7 +162,7 @@ QList<int>* TriDecorator::getSurroundingTriangles( int pointno )
else else
{ {
QgsDebugMsg( "warning, null pointer" ); QgsDebugMsg( "warning, null pointer" );
return 0; return nullptr;
} }
} }
@ -342,6 +342,6 @@ QList<int>* TriDecorator::getPointsAroundEdge( double x, double y )
else else
{ {
QgsDebugMsg( "warning, null pointer" ); QgsDebugMsg( "warning, null pointer" );
return 0; return nullptr;
} }
} }

View File

@ -59,7 +59,7 @@ class ANALYSIS_EXPORT TriDecorator : public Triangulation
Triangulation* mTIN; Triangulation* mTIN;
}; };
inline TriDecorator::TriDecorator(): mTIN( 0 ) inline TriDecorator::TriDecorator(): mTIN( nullptr )
{ {
} }

View File

@ -35,7 +35,7 @@ QgsGridFileWriter::QgsGridFileWriter( QgsInterpolator* i, const QString& outputP
} }
QgsGridFileWriter::QgsGridFileWriter() QgsGridFileWriter::QgsGridFileWriter()
: mInterpolator( 0 ) : mInterpolator( nullptr )
, mNumColumns( 0 ) , mNumColumns( 0 )
, mNumRows( 0 ) , mNumRows( 0 )
, mCellSizeX( 0 ) , mCellSizeX( 0 )
@ -72,10 +72,10 @@ int QgsGridFileWriter::writeFile( bool showProgressDialog )
double currentXValue; double currentXValue;
double interpolatedValue; double interpolatedValue;
QProgressDialog* progressDialog = 0; QProgressDialog* progressDialog = nullptr;
if ( showProgressDialog ) if ( showProgressDialog )
{ {
progressDialog = new QProgressDialog( QObject::tr( "Interpolating..." ), QObject::tr( "Abort" ), 0, mNumRows, 0 ); progressDialog = new QProgressDialog( QObject::tr( "Interpolating..." ), QObject::tr( "Abort" ), 0, mNumRows, nullptr );
progressDialog->setWindowModality( Qt::WindowModal ); progressDialog->setWindowModality( Qt::WindowModal );
} }

View File

@ -54,7 +54,7 @@ int QgsInterpolator::cacheBaseData()
for ( ; v_it != mLayerData.end(); ++v_it ) for ( ; v_it != mLayerData.end(); ++v_it )
{ {
if ( v_it->vectorLayer == 0 ) if ( v_it->vectorLayer == nullptr )
{ {
continue; continue;
} }

View File

@ -29,8 +29,8 @@
QgsTINInterpolator::QgsTINInterpolator( const QList<LayerData>& inputData, TIN_INTERPOLATION interpolation, bool showProgressDialog ) QgsTINInterpolator::QgsTINInterpolator( const QList<LayerData>& inputData, TIN_INTERPOLATION interpolation, bool showProgressDialog )
: QgsInterpolator( inputData ) : QgsInterpolator( inputData )
, mTriangulation( 0 ) , mTriangulation( nullptr )
, mTriangleInterpolator( 0 ) , mTriangleInterpolator( nullptr )
, mIsInitialized( false ) , mIsInitialized( false )
, mShowProgressDialog( showProgressDialog ) , mShowProgressDialog( showProgressDialog )
, mExportTriangulationToFile( false ) , mExportTriangulationToFile( false )
@ -67,7 +67,7 @@ int QgsTINInterpolator::interpolatePoint( double x, double y, double& result )
void QgsTINInterpolator::initialize() void QgsTINInterpolator::initialize()
{ {
DualEdgeTriangulation* theDualEdgeTriangulation = new DualEdgeTriangulation( 100000, 0 ); DualEdgeTriangulation* theDualEdgeTriangulation = new DualEdgeTriangulation( 100000, nullptr );
if ( mInterpolation == CloughTocher ) if ( mInterpolation == CloughTocher )
{ {
NormVecDecorator* dec = new NormVecDecorator(); NormVecDecorator* dec = new NormVecDecorator();
@ -94,10 +94,10 @@ void QgsTINInterpolator::initialize()
} }
} }
QProgressDialog* theProgressDialog = 0; QProgressDialog* theProgressDialog = nullptr;
if ( mShowProgressDialog ) if ( mShowProgressDialog )
{ {
theProgressDialog = new QProgressDialog( QObject::tr( "Building triangulation..." ), QObject::tr( "Abort" ), 0, nFeatures, 0 ); theProgressDialog = new QProgressDialog( QObject::tr( "Building triangulation..." ), QObject::tr( "Abort" ), 0, nFeatures, nullptr );
theProgressDialog->setWindowModality( Qt::WindowModal ); theProgressDialog->setWindowModality( Qt::WindowModal );
} }
@ -140,7 +140,7 @@ void QgsTINInterpolator::initialize()
NormVecDecorator* dec = dynamic_cast<NormVecDecorator*>( mTriangulation ); NormVecDecorator* dec = dynamic_cast<NormVecDecorator*>( mTriangulation );
if ( dec ) if ( dec )
{ {
QProgressDialog* progressDialog = 0; QProgressDialog* progressDialog = nullptr;
if ( mShowProgressDialog ) //show a progress dialog because it can take a long time... if ( mShowProgressDialog ) //show a progress dialog because it can take a long time...
{ {
progressDialog = new QProgressDialog(); progressDialog = new QProgressDialog();
@ -203,7 +203,7 @@ int QgsTINInterpolator::insertData( QgsFeature* f, bool zCoord, int attr, InputT
double x, y, z; double x, y, z;
QgsConstWkbPtr currentWkbPtr( g->asWkb() + 1 + sizeof( int ) ); QgsConstWkbPtr currentWkbPtr( g->asWkb() + 1 + sizeof( int ) );
//maybe a structure or break line //maybe a structure or break line
Line3D* line = 0; Line3D* line = nullptr;
QGis::WkbType wkbType = g->wkbType(); QGis::WkbType wkbType = g->wkbType();
switch ( wkbType ) switch ( wkbType )

View File

@ -28,8 +28,8 @@
void QgsGraphAnalyzer::dijkstra( const QgsGraph* source, int startPointIdx, int criterionNum, QVector<int>* resultTree, QVector<double>* resultCost ) void QgsGraphAnalyzer::dijkstra( const QgsGraph* source, int startPointIdx, int criterionNum, QVector<int>* resultTree, QVector<double>* resultCost )
{ {
QVector< double > * result = NULL; QVector< double > * result = nullptr;
if ( resultCost != NULL ) if ( resultCost != nullptr )
{ {
result = resultCost; result = resultCost;
} }
@ -42,7 +42,7 @@ void QgsGraphAnalyzer::dijkstra( const QgsGraph* source, int startPointIdx, int
result->insert( result->begin(), source->vertexCount(), std::numeric_limits<double>::infinity() ); result->insert( result->begin(), source->vertexCount(), std::numeric_limits<double>::infinity() );
( *result )[ startPointIdx ] = 0.0; ( *result )[ startPointIdx ] = 0.0;
if ( resultTree != NULL ) if ( resultTree != nullptr )
{ {
resultTree->clear(); resultTree->clear();
resultTree->insert( resultTree->begin(), source->vertexCount(), -1 ); resultTree->insert( resultTree->begin(), source->vertexCount(), -1 );
@ -73,7 +73,7 @@ void QgsGraphAnalyzer::dijkstra( const QgsGraph* source, int startPointIdx, int
if ( cost < ( *result )[ arc.inVertex()] ) if ( cost < ( *result )[ arc.inVertex()] )
{ {
( *result )[ arc.inVertex()] = cost; ( *result )[ arc.inVertex()] = cost;
if ( resultTree != NULL ) if ( resultTree != nullptr )
{ {
( *resultTree )[ arc.inVertex()] = *arcIt; ( *resultTree )[ arc.inVertex()] = *arcIt;
} }
@ -81,7 +81,7 @@ void QgsGraphAnalyzer::dijkstra( const QgsGraph* source, int startPointIdx, int
} }
} }
} }
if ( resultCost == NULL ) if ( resultCost == nullptr )
{ {
delete result; delete result;
} }

View File

@ -39,7 +39,7 @@ class ANALYSIS_EXPORT QgsGraphAnalyzer
* @param resultTree array represents the shortest path tree. resultTree[ vertexIndex ] == inboundingArcIndex if vertex reacheble and resultTree[ vertexIndex ] == -1 others. * @param resultTree array represents the shortest path tree. resultTree[ vertexIndex ] == inboundingArcIndex if vertex reacheble and resultTree[ vertexIndex ] == -1 others.
* @param resultCost array of cost paths * @param resultCost array of cost paths
*/ */
static void dijkstra( const QgsGraph* source, int startVertexIdx, int criterionNum, QVector<int>* resultTree = NULL, QVector<double>* resultCost = NULL ); static void dijkstra( const QgsGraph* source, int startVertexIdx, int criterionNum, QVector<int>* resultTree = nullptr, QVector<double>* resultCost = nullptr );
/** /**
* return shortest path tree with root-node in startVertexIdx * return shortest path tree with root-node in startVertexIdx

View File

@ -29,7 +29,7 @@ QgsGraphBuilder::QgsGraphBuilder( const QgsCoordinateReferenceSystem& crs, bool
QgsGraphBuilder::~QgsGraphBuilder() QgsGraphBuilder::~QgsGraphBuilder()
{ {
if ( mGraph != NULL ) if ( mGraph != nullptr )
delete mGraph; delete mGraph;
} }
@ -46,6 +46,6 @@ void QgsGraphBuilder::addArc( int pt1id, const QgsPoint&, int pt2id, const QgsPo
QgsGraph* QgsGraphBuilder::graph() QgsGraph* QgsGraphBuilder::graph()
{ {
QgsGraph* res = mGraph; QgsGraph* res = mGraph;
mGraph = NULL; mGraph = nullptr;
return res; return res;
} }

View File

@ -130,7 +130,7 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c
{ {
QgsVectorLayer *vl = mVectorLayer; QgsVectorLayer *vl = mVectorLayer;
if ( vl == NULL ) if ( vl == nullptr )
return; return;
int featureCount = ( int ) vl->featureCount() * 2; int featureCount = ( int ) vl->featureCount() * 2;

View File

@ -21,13 +21,13 @@
QgsOSMDatabase::QgsOSMDatabase( const QString& dbFileName ) QgsOSMDatabase::QgsOSMDatabase( const QString& dbFileName )
: mDbFileName( dbFileName ) : mDbFileName( dbFileName )
, mDatabase( 0 ) , mDatabase( nullptr )
, mStmtNode( 0 ) , mStmtNode( nullptr )
, mStmtNodeTags( 0 ) , mStmtNodeTags( nullptr )
, mStmtWay( 0 ) , mStmtWay( nullptr )
, mStmtWayNode( 0 ) , mStmtWayNode( nullptr )
, mStmtWayNodePoints( 0 ) , mStmtWayNodePoints( nullptr )
, mStmtWayTags( 0 ) , mStmtWayTags( nullptr )
{ {
} }
@ -39,14 +39,14 @@ QgsOSMDatabase::~QgsOSMDatabase()
bool QgsOSMDatabase::isOpen() const bool QgsOSMDatabase::isOpen() const
{ {
return mDatabase != 0; return mDatabase != nullptr;
} }
bool QgsOSMDatabase::open() bool QgsOSMDatabase::open()
{ {
// open database // open database
int res = QgsSLConnect::sqlite3_open_v2( mDbFileName.toUtf8().data(), &mDatabase, SQLITE_OPEN_READWRITE, 0 ); int res = QgsSLConnect::sqlite3_open_v2( mDbFileName.toUtf8().data(), &mDatabase, SQLITE_OPEN_READWRITE, nullptr );
if ( res != SQLITE_OK ) if ( res != SQLITE_OK )
{ {
mError = QString( "Failed to open database [%1]: %2" ).arg( res ).arg( mDbFileName ); mError = QString( "Failed to open database [%1]: %2" ).arg( res ).arg( mDbFileName );
@ -69,7 +69,7 @@ void QgsOSMDatabase::deleteStatement( sqlite3_stmt*& stmt )
if ( stmt ) if ( stmt )
{ {
sqlite3_finalize( stmt ); sqlite3_finalize( stmt );
stmt = 0; stmt = nullptr;
} }
} }
@ -83,7 +83,7 @@ bool QgsOSMDatabase::close()
deleteStatement( mStmtWayNodePoints ); deleteStatement( mStmtWayNodePoints );
deleteStatement( mStmtWayTags ); deleteStatement( mStmtWayTags );
Q_ASSERT( mStmtNode == 0 ); Q_ASSERT( mStmtNode == nullptr );
// close database // close database
if ( QgsSLConnect::sqlite3_close( mDatabase ) != SQLITE_OK ) if ( QgsSLConnect::sqlite3_close( mDatabase ) != SQLITE_OK )
@ -91,7 +91,7 @@ bool QgsOSMDatabase::close()
//mError = ( char * ) "Closing SQLite3 database failed."; //mError = ( char * ) "Closing SQLite3 database failed.";
//return false; //return false;
} }
mDatabase = 0; mDatabase = nullptr;
return true; return true;
} }
@ -99,7 +99,7 @@ bool QgsOSMDatabase::close()
int QgsOSMDatabase::runCountStatement( const char* sql ) const int QgsOSMDatabase::runCountStatement( const char* sql ) const
{ {
sqlite3_stmt* stmt; sqlite3_stmt* stmt;
int res = sqlite3_prepare_v2( mDatabase, sql, -1, &stmt, 0 ); int res = sqlite3_prepare_v2( mDatabase, sql, -1, &stmt, nullptr );
if ( res != SQLITE_OK ) if ( res != SQLITE_OK )
return -1; return -1;
@ -183,7 +183,7 @@ QList<QgsOSMTagCountPair> QgsOSMDatabase::usedTags( bool ways ) const
QString sql = QString( "SELECT k, count(k) FROM %1_tags GROUP BY k" ).arg( ways ? "ways" : "nodes" ); QString sql = QString( "SELECT k, count(k) FROM %1_tags GROUP BY k" ).arg( ways ? "ways" : "nodes" );
sqlite3_stmt* stmt; sqlite3_stmt* stmt;
if ( sqlite3_prepare_v2( mDatabase, sql.toUtf8().data(), -1, &stmt, 0 ) != SQLITE_OK ) if ( sqlite3_prepare_v2( mDatabase, sql.toUtf8().data(), -1, &stmt, nullptr ) != SQLITE_OK )
return pairs; return pairs;
while ( sqlite3_step( stmt ) == SQLITE_ROW ) while ( sqlite3_step( stmt ) == SQLITE_ROW )
@ -278,7 +278,7 @@ bool QgsOSMDatabase::prepareStatements()
for ( int i = 0; i < count; ++i ) for ( int i = 0; i < count; ++i )
{ {
if ( sqlite3_prepare_v2( mDatabase, sql[i], -1, sqlite[i], 0 ) != SQLITE_OK ) if ( sqlite3_prepare_v2( mDatabase, sql[i], -1, sqlite[i], nullptr ) != SQLITE_OK )
{ {
const char* errMsg = sqlite3_errmsg( mDatabase ); // does not require free const char* errMsg = sqlite3_errmsg( mDatabase ); // does not require free
mError = QString( "Error preparing SQL command:\n%1\nSQL:\n%2" ) mError = QString( "Error preparing SQL command:\n%1\nSQL:\n%2" )
@ -309,7 +309,7 @@ bool QgsOSMDatabase::exportSpatiaLite( ExportType type, const QString& tableName
// import data // import data
int retX = sqlite3_exec( mDatabase, "BEGIN", NULL, NULL, 0 ); int retX = sqlite3_exec( mDatabase, "BEGIN", nullptr, nullptr, nullptr );
Q_ASSERT( retX == SQLITE_OK ); Q_ASSERT( retX == SQLITE_OK );
Q_UNUSED( retX ); Q_UNUSED( retX );
@ -320,7 +320,7 @@ bool QgsOSMDatabase::exportSpatiaLite( ExportType type, const QString& tableName
else else
Q_ASSERT( false && "Unknown export type" ); Q_ASSERT( false && "Unknown export type" );
int retY = sqlite3_exec( mDatabase, "COMMIT", NULL, NULL, 0 ); int retY = sqlite3_exec( mDatabase, "COMMIT", nullptr, nullptr, nullptr );
Q_ASSERT( retY == SQLITE_OK ); Q_ASSERT( retY == SQLITE_OK );
Q_UNUSED( retY ); Q_UNUSED( retY );
@ -338,8 +338,8 @@ bool QgsOSMDatabase::createSpatialTable( const QString& tableName, const QString
sqlCreateTable += QString( ", %1 TEXT" ).arg( quotedIdentifier( tagKeys[i] ) ); sqlCreateTable += QString( ", %1 TEXT" ).arg( quotedIdentifier( tagKeys[i] ) );
sqlCreateTable += ')'; sqlCreateTable += ')';
char *errMsg = NULL; char *errMsg = nullptr;
int ret = sqlite3_exec( mDatabase, sqlCreateTable.toUtf8().constData(), NULL, NULL, &errMsg ); int ret = sqlite3_exec( mDatabase, sqlCreateTable.toUtf8().constData(), nullptr, nullptr, &errMsg );
if ( ret != SQLITE_OK ) if ( ret != SQLITE_OK )
{ {
mError = "Unable to create table:\n" + QString::fromUtf8( errMsg ); mError = "Unable to create table:\n" + QString::fromUtf8( errMsg );
@ -350,7 +350,7 @@ bool QgsOSMDatabase::createSpatialTable( const QString& tableName, const QString
QString sqlAddGeomColumn = QString( "SELECT AddGeometryColumn(%1, 'geometry', 4326, %2, 'XY')" ) QString sqlAddGeomColumn = QString( "SELECT AddGeometryColumn(%1, 'geometry', 4326, %2, 'XY')" )
.arg( quotedValue( tableName ), .arg( quotedValue( tableName ),
quotedValue( geometryType ) ); quotedValue( geometryType ) );
ret = sqlite3_exec( mDatabase, sqlAddGeomColumn.toUtf8().constData(), NULL, NULL, &errMsg ); ret = sqlite3_exec( mDatabase, sqlAddGeomColumn.toUtf8().constData(), nullptr, nullptr, &errMsg );
if ( ret != SQLITE_OK ) if ( ret != SQLITE_OK )
{ {
mError = "Unable to add geometry column:\n" + QString::fromUtf8( errMsg ); mError = "Unable to add geometry column:\n" + QString::fromUtf8( errMsg );
@ -365,8 +365,8 @@ bool QgsOSMDatabase::createSpatialTable( const QString& tableName, const QString
bool QgsOSMDatabase::createSpatialIndex( const QString& tableName ) bool QgsOSMDatabase::createSpatialIndex( const QString& tableName )
{ {
QString sqlSpatialIndex = QString( "SELECT CreateSpatialIndex(%1, 'geometry')" ).arg( quotedValue( tableName ) ); QString sqlSpatialIndex = QString( "SELECT CreateSpatialIndex(%1, 'geometry')" ).arg( quotedValue( tableName ) );
char *errMsg = NULL; char *errMsg = nullptr;
int ret = sqlite3_exec( mDatabase, sqlSpatialIndex.toUtf8().constData(), NULL, NULL, &errMsg ); int ret = sqlite3_exec( mDatabase, sqlSpatialIndex.toUtf8().constData(), nullptr, nullptr, &errMsg );
if ( ret != SQLITE_OK ) if ( ret != SQLITE_OK )
{ {
mError = "Unable to create spatial index:\n" + QString::fromUtf8( errMsg ); mError = "Unable to create spatial index:\n" + QString::fromUtf8( errMsg );
@ -385,7 +385,7 @@ void QgsOSMDatabase::exportSpatiaLiteNodes( const QString& tableName, const QStr
sqlInsertPoint += QString( ",?" ); sqlInsertPoint += QString( ",?" );
sqlInsertPoint += ", GeomFromWKB(?, 4326))"; sqlInsertPoint += ", GeomFromWKB(?, 4326))";
sqlite3_stmt* stmtInsert; sqlite3_stmt* stmtInsert;
if ( sqlite3_prepare_v2( mDatabase, sqlInsertPoint.toUtf8().constData(), -1, &stmtInsert, 0 ) != SQLITE_OK ) if ( sqlite3_prepare_v2( mDatabase, sqlInsertPoint.toUtf8().constData(), -1, &stmtInsert, nullptr ) != SQLITE_OK )
{ {
mError = "Prepare SELECT FROM nodes failed."; mError = "Prepare SELECT FROM nodes failed.";
return; return;
@ -453,7 +453,7 @@ void QgsOSMDatabase::exportSpatiaLiteWays( bool closed, const QString& tableName
sqlInsertLine += QString( ",?" ); sqlInsertLine += QString( ",?" );
sqlInsertLine += ", GeomFromWKB(?, 4326))"; sqlInsertLine += ", GeomFromWKB(?, 4326))";
sqlite3_stmt* stmtInsert; sqlite3_stmt* stmtInsert;
if ( sqlite3_prepare_v2( mDatabase, sqlInsertLine.toUtf8().constData(), -1, &stmtInsert, 0 ) != SQLITE_OK ) if ( sqlite3_prepare_v2( mDatabase, sqlInsertLine.toUtf8().constData(), -1, &stmtInsert, nullptr ) != SQLITE_OK )
{ {
mError = "Prepare SELECT FROM ways failed."; mError = "Prepare SELECT FROM ways failed.";
return; return;
@ -547,10 +547,10 @@ QString QgsOSMDatabase::quotedValue( QString value )
QgsOSMNodeIterator::QgsOSMNodeIterator( sqlite3* handle ) QgsOSMNodeIterator::QgsOSMNodeIterator( sqlite3* handle )
: mStmt( 0 ) : mStmt( nullptr )
{ {
const char* sql = "SELECT id,lon,lat FROM nodes"; const char* sql = "SELECT id,lon,lat FROM nodes";
if ( sqlite3_prepare_v2( handle, sql, -1, &mStmt, 0 ) != SQLITE_OK ) if ( sqlite3_prepare_v2( handle, sql, -1, &mStmt, nullptr ) != SQLITE_OK )
{ {
qDebug( "OSMNodeIterator: error prepare" ); qDebug( "OSMNodeIterator: error prepare" );
} }
@ -585,7 +585,7 @@ void QgsOSMNodeIterator::close()
if ( mStmt ) if ( mStmt )
{ {
sqlite3_finalize( mStmt ); sqlite3_finalize( mStmt );
mStmt = 0; mStmt = nullptr;
} }
} }
@ -593,10 +593,10 @@ void QgsOSMNodeIterator::close()
QgsOSMWayIterator::QgsOSMWayIterator( sqlite3* handle ) QgsOSMWayIterator::QgsOSMWayIterator( sqlite3* handle )
: mStmt( 0 ) : mStmt( nullptr )
{ {
const char* sql = "SELECT id FROM ways"; const char* sql = "SELECT id FROM ways";
if ( sqlite3_prepare_v2( handle, sql, -1, &mStmt, 0 ) != SQLITE_OK ) if ( sqlite3_prepare_v2( handle, sql, -1, &mStmt, nullptr ) != SQLITE_OK )
{ {
qDebug( "OSMWayIterator: error prepare" ); qDebug( "OSMWayIterator: error prepare" );
} }
@ -629,6 +629,6 @@ void QgsOSMWayIterator::close()
if ( mStmt ) if ( mStmt )
{ {
sqlite3_finalize( mStmt ); sqlite3_finalize( mStmt );
mStmt = 0; mStmt = nullptr;
} }
} }

View File

@ -22,7 +22,7 @@ QString QgsOSMDownload::queryFromRect( const QgsRectangle& rect )
QgsOSMDownload::QgsOSMDownload() QgsOSMDownload::QgsOSMDownload()
: mServiceUrl( defaultServiceUrl() ), mReply( 0 ) : mServiceUrl( defaultServiceUrl() ), mReply( nullptr )
{ {
} }
@ -32,7 +32,7 @@ QgsOSMDownload::~QgsOSMDownload()
{ {
mReply->abort(); mReply->abort();
mReply->deleteLater(); mReply->deleteLater();
mReply = 0; mReply = nullptr;
} }
} }
@ -103,7 +103,7 @@ void QgsOSMDownload::onFinished()
Q_ASSERT( mReply ); Q_ASSERT( mReply );
mReply->deleteLater(); mReply->deleteLater();
mReply = 0; mReply = nullptr;
mFile.close(); mFile.close();

View File

@ -23,12 +23,12 @@
QgsOSMXmlImport::QgsOSMXmlImport( const QString& xmlFilename, const QString& dbFilename ) QgsOSMXmlImport::QgsOSMXmlImport( const QString& xmlFilename, const QString& dbFilename )
: mXmlFileName( xmlFilename ) : mXmlFileName( xmlFilename )
, mDbFileName( dbFilename ) , mDbFileName( dbFilename )
, mDatabase( 0 ) , mDatabase( nullptr )
, mStmtInsertNode( 0 ) , mStmtInsertNode( nullptr )
, mStmtInsertNodeTag( 0 ) , mStmtInsertNodeTag( nullptr )
, mStmtInsertWay( 0 ) , mStmtInsertWay( nullptr )
, mStmtInsertWayNode( 0 ) , mStmtInsertWayNode( nullptr )
, mStmtInsertWayTag( 0 ) , mStmtInsertWayTag( nullptr )
{ {
} }
@ -64,7 +64,7 @@ bool QgsOSMXmlImport::import()
qDebug( "starting import" ); qDebug( "starting import" );
int retX = sqlite3_exec( mDatabase, "BEGIN", NULL, NULL, 0 ); int retX = sqlite3_exec( mDatabase, "BEGIN", nullptr, nullptr, nullptr );
Q_ASSERT( retX == SQLITE_OK ); Q_ASSERT( retX == SQLITE_OK );
Q_UNUSED( retX ); Q_UNUSED( retX );
@ -88,7 +88,7 @@ bool QgsOSMXmlImport::import()
} }
} }
int retY = sqlite3_exec( mDatabase, "COMMIT", NULL, NULL, 0 ); int retY = sqlite3_exec( mDatabase, "COMMIT", nullptr, nullptr, nullptr );
Q_ASSERT( retY == SQLITE_OK ); Q_ASSERT( retY == SQLITE_OK );
Q_UNUSED( retY ); Q_UNUSED( retY );
@ -117,7 +117,7 @@ bool QgsOSMXmlImport::createIndexes()
int count = sizeof( sqlIndexes ) / sizeof( const char* ); int count = sizeof( sqlIndexes ) / sizeof( const char* );
for ( int i = 0; i < count; ++i ) for ( int i = 0; i < count; ++i )
{ {
int ret = sqlite3_exec( mDatabase, sqlIndexes[i], 0, 0, 0 ); int ret = sqlite3_exec( mDatabase, sqlIndexes[i], nullptr, nullptr, nullptr );
if ( ret != SQLITE_OK ) if ( ret != SQLITE_OK )
{ {
mError = "Error creating indexes!"; mError = "Error creating indexes!";
@ -133,11 +133,11 @@ bool QgsOSMXmlImport::createDatabase()
{ {
char **results; char **results;
int rows, columns; int rows, columns;
if ( QgsSLConnect::sqlite3_open_v2( mDbFileName.toUtf8().data(), &mDatabase, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0 ) != SQLITE_OK ) if ( QgsSLConnect::sqlite3_open_v2( mDbFileName.toUtf8().data(), &mDatabase, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nullptr ) != SQLITE_OK )
return false; return false;
bool above41 = false; bool above41 = false;
int ret = sqlite3_get_table( mDatabase, "select spatialite_version()", &results, &rows, &columns, NULL ); int ret = sqlite3_get_table( mDatabase, "select spatialite_version()", &results, &rows, &columns, nullptr );
if ( ret == SQLITE_OK && rows == 1 && columns == 1 ) if ( ret == SQLITE_OK && rows == 1 && columns == 1 )
{ {
QString version = QString::fromUtf8( results[1] ); QString version = QString::fromUtf8( results[1] );
@ -166,7 +166,7 @@ bool QgsOSMXmlImport::createDatabase()
for ( int i = 0; i < initCount; ++i ) for ( int i = 0; i < initCount; ++i )
{ {
char* errMsg; char* errMsg;
if ( sqlite3_exec( mDatabase, sqlInitStatements[i], 0, 0, &errMsg ) != SQLITE_OK ) if ( sqlite3_exec( mDatabase, sqlInitStatements[i], nullptr, nullptr, &errMsg ) != SQLITE_OK )
{ {
mError = QString( "Error executing SQL command:\n%1\nSQL:\n%2" ) mError = QString( "Error executing SQL command:\n%1\nSQL:\n%2" )
.arg( QString::fromUtf8( errMsg ), QString::fromUtf8( sqlInitStatements[i] ) ); .arg( QString::fromUtf8( errMsg ), QString::fromUtf8( sqlInitStatements[i] ) );
@ -197,7 +197,7 @@ bool QgsOSMXmlImport::createDatabase()
for ( int i = 0; i < insertCount; ++i ) for ( int i = 0; i < insertCount; ++i )
{ {
if ( sqlite3_prepare_v2( mDatabase, sqlInsertStatements[i], -1, sqliteInsertStatements[i], 0 ) != SQLITE_OK ) if ( sqlite3_prepare_v2( mDatabase, sqlInsertStatements[i], -1, sqliteInsertStatements[i], nullptr ) != SQLITE_OK )
{ {
const char* errMsg = sqlite3_errmsg( mDatabase ); // does not require free const char* errMsg = sqlite3_errmsg( mDatabase ); // does not require free
mError = QString( "Error preparing SQL command:\n%1\nSQL:\n%2" ) mError = QString( "Error preparing SQL command:\n%1\nSQL:\n%2" )
@ -216,7 +216,7 @@ void QgsOSMXmlImport::deleteStatement( sqlite3_stmt*& stmt )
if ( stmt ) if ( stmt )
{ {
sqlite3_finalize( stmt ); sqlite3_finalize( stmt );
stmt = 0; stmt = nullptr;
} }
} }
@ -232,10 +232,10 @@ bool QgsOSMXmlImport::closeDatabase()
deleteStatement( mStmtInsertWayNode ); deleteStatement( mStmtInsertWayNode );
deleteStatement( mStmtInsertWayTag ); deleteStatement( mStmtInsertWayTag );
Q_ASSERT( mStmtInsertNode == 0 ); Q_ASSERT( mStmtInsertNode == nullptr );
QgsSLConnect::sqlite3_close( mDatabase ); QgsSLConnect::sqlite3_close( mDatabase );
mDatabase = 0; mDatabase = nullptr;
return true; return true;
} }

View File

@ -117,7 +117,7 @@ static CPLErr rescalePostWarpChunkProcessor( void* pKern, void* pArg )
QgsAlignRaster::QgsAlignRaster() QgsAlignRaster::QgsAlignRaster()
: mProgressHandler( 0 ) : mProgressHandler( nullptr )
{ {
// parameters // parameters
mCellSizeX = mCellSizeY = 0; mCellSizeX = mCellSizeY = 0;
@ -267,7 +267,7 @@ bool QgsAlignRaster::checkInputParameters()
QSizeF cs; QSizeF cs;
QgsRectangle extent; QgsRectangle extent;
if ( !suggestedWarpOutput( info, mCrsWkt, &cs, 0, &extent ) ) if ( !suggestedWarpOutput( info, mCrsWkt, &cs, nullptr, &extent ) )
{ {
mErrorMessage = QString( "Failed to get suggested warp output.\n\n" mErrorMessage = QString( "Failed to get suggested warp output.\n\n"
"File:\n%1\n\n" "File:\n%1\n\n"
@ -444,7 +444,7 @@ bool QgsAlignRaster::createAndWarp( const Item& raster )
// Create the output file. // Create the output file.
GDALDatasetH hDstDS; GDALDatasetH hDstDS;
hDstDS = GDALCreate( hDriver, raster.outputFilename.toLocal8Bit().constData(), mXSize, mYSize, hDstDS = GDALCreate( hDriver, raster.outputFilename.toLocal8Bit().constData(), mXSize, mYSize,
bandCount, eDT, NULL ); bandCount, eDT, nullptr );
if ( !hDstDS ) if ( !hDstDS )
{ {
GDALClose( hSrcDS ); GDALClose( hSrcDS );
@ -458,7 +458,7 @@ bool QgsAlignRaster::createAndWarp( const Item& raster )
// Copy the color table, if required. // Copy the color table, if required.
GDALColorTableH hCT = GDALGetRasterColorTable( GDALGetRasterBand( hSrcDS, 1 ) ); GDALColorTableH hCT = GDALGetRasterColorTable( GDALGetRasterBand( hSrcDS, 1 ) );
if ( hCT != NULL ) if ( hCT != nullptr )
GDALSetRasterColorTable( GDALGetRasterBand( hDstDS, 1 ), hCT ); GDALSetRasterColorTable( GDALGetRasterBand( hDstDS, 1 ), hCT );
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@ -522,7 +522,7 @@ bool QgsAlignRaster::suggestedWarpOutput( const QgsAlignRaster::RasterInfo& info
// to destination georeferenced coordinates (not destination // to destination georeferenced coordinates (not destination
// pixel line). We do that by omitting the destination dataset // pixel line). We do that by omitting the destination dataset
// handle (setting it to NULL). // handle (setting it to NULL).
void* hTransformArg = GDALCreateGenImgProjTransformer( info.mDataset, info.mCrsWkt.toAscii().constData(), NULL, destWkt.toAscii().constData(), FALSE, 0, 1 ); void* hTransformArg = GDALCreateGenImgProjTransformer( info.mDataset, info.mCrsWkt.toAscii().constData(), nullptr, destWkt.toAscii().constData(), FALSE, 0, 1 );
if ( !hTransformArg ) if ( !hTransformArg )
return false; return false;

View File

@ -49,7 +49,7 @@ class ANALYSIS_EXPORT QgsAlignRaster
~RasterInfo(); ~RasterInfo();
//! Check whether the given path is a valid raster //! Check whether the given path is a valid raster
bool isValid() const { return mDataset != 0; } bool isValid() const { return mDataset != nullptr; }
//! Return CRS in WKT format //! Return CRS in WKT format
QString crs() const { return mCrsWkt; } QString crs() const { return mCrsWkt; }
@ -218,7 +218,7 @@ class ANALYSIS_EXPORT QgsAlignRaster
bool createAndWarp( const Item& raster ); bool createAndWarp( const Item& raster );
//! Determine suggested output of raster warp to a different CRS. Returns true on success //! Determine suggested output of raster warp to a different CRS. Returns true on success
static bool suggestedWarpOutput( const RasterInfo& info, const QString& destWkt, QSizeF* cellSize = 0, QPointF* gridOffset = 0, QgsRectangle* rect = 0 ); static bool suggestedWarpOutput( const RasterInfo& info, const QString& destWkt, QSizeF* cellSize = nullptr, QPointF* gridOffset = nullptr, QgsRectangle* rect = nullptr );
protected: protected:

View File

@ -60,36 +60,36 @@ int QgsNineCellFilter::processRaster( QProgressDialog* p )
//open input file //open input file
int xSize, ySize; int xSize, ySize;
GDALDatasetH inputDataset = openInputFile( xSize, ySize ); GDALDatasetH inputDataset = openInputFile( xSize, ySize );
if ( inputDataset == NULL ) if ( inputDataset == nullptr )
{ {
return 1; //opening of input file failed return 1; //opening of input file failed
} }
//output driver //output driver
GDALDriverH outputDriver = openOutputDriver(); GDALDriverH outputDriver = openOutputDriver();
if ( outputDriver == 0 ) if ( outputDriver == nullptr )
{ {
return 2; return 2;
} }
GDALDatasetH outputDataset = openOutputFile( inputDataset, outputDriver ); GDALDatasetH outputDataset = openOutputFile( inputDataset, outputDriver );
if ( outputDataset == NULL ) if ( outputDataset == nullptr )
{ {
return 3; //create operation on output file failed return 3; //create operation on output file failed
} }
//open first raster band for reading (operation is only for single band raster) //open first raster band for reading (operation is only for single band raster)
GDALRasterBandH rasterBand = GDALGetRasterBand( inputDataset, 1 ); GDALRasterBandH rasterBand = GDALGetRasterBand( inputDataset, 1 );
if ( rasterBand == NULL ) if ( rasterBand == nullptr )
{ {
GDALClose( inputDataset ); GDALClose( inputDataset );
GDALClose( outputDataset ); GDALClose( outputDataset );
return 4; return 4;
} }
mInputNodataValue = GDALGetRasterNoDataValue( rasterBand, NULL ); mInputNodataValue = GDALGetRasterNoDataValue( rasterBand, nullptr );
GDALRasterBandH outputRasterBand = GDALGetRasterBand( outputDataset, 1 ); GDALRasterBandH outputRasterBand = GDALGetRasterBand( outputDataset, 1 );
if ( outputRasterBand == NULL ) if ( outputRasterBand == nullptr )
{ {
GDALClose( inputDataset ); GDALClose( inputDataset );
GDALClose( outputDataset ); GDALClose( outputDataset );
@ -97,7 +97,7 @@ int QgsNineCellFilter::processRaster( QProgressDialog* p )
} }
//try to set -9999 as nodata value //try to set -9999 as nodata value
GDALSetRasterNoDataValue( outputRasterBand, -9999 ); GDALSetRasterNoDataValue( outputRasterBand, -9999 );
mOutputNodataValue = GDALGetRasterNoDataValue( outputRasterBand, NULL ); mOutputNodataValue = GDALGetRasterNoDataValue( outputRasterBand, nullptr );
if ( ySize < 3 ) //we require at least three rows (should be true for most datasets) if ( ySize < 3 ) //we require at least three rows (should be true for most datasets)
{ {
@ -209,7 +209,7 @@ int QgsNineCellFilter::processRaster( QProgressDialog* p )
GDALDatasetH QgsNineCellFilter::openInputFile( int& nCellsX, int& nCellsY ) GDALDatasetH QgsNineCellFilter::openInputFile( int& nCellsX, int& nCellsY )
{ {
GDALDatasetH inputDataset = GDALOpen( TO8F( mInputFile ), GA_ReadOnly ); GDALDatasetH inputDataset = GDALOpen( TO8F( mInputFile ), GA_ReadOnly );
if ( inputDataset != NULL ) if ( inputDataset != nullptr )
{ {
nCellsX = GDALGetRasterXSize( inputDataset ); nCellsX = GDALGetRasterXSize( inputDataset );
nCellsY = GDALGetRasterYSize( inputDataset ); nCellsY = GDALGetRasterYSize( inputDataset );
@ -218,7 +218,7 @@ GDALDatasetH QgsNineCellFilter::openInputFile( int& nCellsX, int& nCellsY )
if ( GDALGetRasterCount( inputDataset ) < 1 ) if ( GDALGetRasterCount( inputDataset ) < 1 )
{ {
GDALClose( inputDataset ); GDALClose( inputDataset );
return NULL; return nullptr;
} }
} }
return inputDataset; return inputDataset;
@ -231,15 +231,15 @@ GDALDriverH QgsNineCellFilter::openOutputDriver()
//open driver //open driver
GDALDriverH outputDriver = GDALGetDriverByName( mOutputFormat.toLocal8Bit().data() ); GDALDriverH outputDriver = GDALGetDriverByName( mOutputFormat.toLocal8Bit().data() );
if ( outputDriver == NULL ) if ( outputDriver == nullptr )
{ {
return outputDriver; //return NULL, driver does not exist return outputDriver; //return NULL, driver does not exist
} }
driverMetadata = GDALGetMetadata( outputDriver, NULL ); driverMetadata = GDALGetMetadata( outputDriver, nullptr );
if ( !CSLFetchBoolean( driverMetadata, GDAL_DCAP_CREATE, false ) ) if ( !CSLFetchBoolean( driverMetadata, GDAL_DCAP_CREATE, false ) )
{ {
return NULL; //driver exist, but it does not support the create operation return nullptr; //driver exist, but it does not support the create operation
} }
return outputDriver; return outputDriver;
@ -247,18 +247,18 @@ GDALDriverH QgsNineCellFilter::openOutputDriver()
GDALDatasetH QgsNineCellFilter::openOutputFile( GDALDatasetH inputDataset, GDALDriverH outputDriver ) GDALDatasetH QgsNineCellFilter::openOutputFile( GDALDatasetH inputDataset, GDALDriverH outputDriver )
{ {
if ( inputDataset == NULL ) if ( inputDataset == nullptr )
{ {
return NULL; return nullptr;
} }
int xSize = GDALGetRasterXSize( inputDataset ); int xSize = GDALGetRasterXSize( inputDataset );
int ySize = GDALGetRasterYSize( inputDataset ); int ySize = GDALGetRasterYSize( inputDataset );
//open output file //open output file
char **papszOptions = NULL; char **papszOptions = nullptr;
GDALDatasetH outputDataset = GDALCreate( outputDriver, TO8F( mOutputFile ), xSize, ySize, 1, GDT_Float32, papszOptions ); GDALDatasetH outputDataset = GDALCreate( outputDriver, TO8F( mOutputFile ), xSize, ySize, 1, GDT_Float32, papszOptions );
if ( outputDataset == NULL ) if ( outputDataset == nullptr )
{ {
return outputDataset; return outputDataset;
} }
@ -268,7 +268,7 @@ GDALDatasetH QgsNineCellFilter::openOutputFile( GDALDatasetH inputDataset, GDALD
if ( GDALGetGeoTransform( inputDataset, geotransform ) != CE_None ) if ( GDALGetGeoTransform( inputDataset, geotransform ) != CE_None )
{ {
GDALClose( outputDataset ); GDALClose( outputDataset );
return NULL; return nullptr;
} }
GDALSetGeoTransform( outputDataset, geotransform ); GDALSetGeoTransform( outputDataset, geotransform );

View File

@ -18,28 +18,28 @@
QgsRasterCalcNode::QgsRasterCalcNode() QgsRasterCalcNode::QgsRasterCalcNode()
: mType( tNumber ) : mType( tNumber )
, mLeft( 0 ) , mLeft( nullptr )
, mRight( 0 ) , mRight( nullptr )
, mNumber( 0 ) , mNumber( 0 )
, mMatrix( 0 ) , mMatrix( nullptr )
, mOperator( opNONE ) , mOperator( opNONE )
{ {
} }
QgsRasterCalcNode::QgsRasterCalcNode( double number ) QgsRasterCalcNode::QgsRasterCalcNode( double number )
: mType( tNumber ) : mType( tNumber )
, mLeft( 0 ) , mLeft( nullptr )
, mRight( 0 ) , mRight( nullptr )
, mNumber( number ) , mNumber( number )
, mMatrix( 0 ) , mMatrix( nullptr )
, mOperator( opNONE ) , mOperator( opNONE )
{ {
} }
QgsRasterCalcNode::QgsRasterCalcNode( QgsRasterMatrix* matrix ) QgsRasterCalcNode::QgsRasterCalcNode( QgsRasterMatrix* matrix )
: mType( tMatrix ) : mType( tMatrix )
, mLeft( 0 ) , mLeft( nullptr )
, mRight( 0 ) , mRight( nullptr )
, mNumber( 0 ) , mNumber( 0 )
, mMatrix( matrix ) , mMatrix( matrix )
, mOperator( opNONE ) , mOperator( opNONE )
@ -52,18 +52,18 @@ QgsRasterCalcNode::QgsRasterCalcNode( Operator op, QgsRasterCalcNode* left, QgsR
, mLeft( left ) , mLeft( left )
, mRight( right ) , mRight( right )
, mNumber( 0 ) , mNumber( 0 )
, mMatrix( 0 ) , mMatrix( nullptr )
, mOperator( op ) , mOperator( op )
{ {
} }
QgsRasterCalcNode::QgsRasterCalcNode( const QString& rasterName ) QgsRasterCalcNode::QgsRasterCalcNode( const QString& rasterName )
: mType( tRasterRef ) : mType( tRasterRef )
, mLeft( 0 ) , mLeft( nullptr )
, mRight( 0 ) , mRight( nullptr )
, mNumber( 0 ) , mNumber( 0 )
, mRasterName( rasterName ) , mRasterName( rasterName )
, mMatrix( 0 ) , mMatrix( nullptr )
, mOperator( opNONE ) , mOperator( opNONE )
{ {
if ( mRasterName.startsWith( '"' ) && mRasterName.endsWith( '"' ) ) if ( mRasterName.startsWith( '"' ) && mRasterName.endsWith( '"' ) )

View File

@ -86,7 +86,7 @@ int QgsRasterCalculator::processCalculation( QProgressDialog* p )
return 2; return 2;
} }
QgsRasterBlock* block = 0; QgsRasterBlock* block = nullptr;
// if crs transform needed // if crs transform needed
if ( it->raster->crs() != mOutputCrs ) if ( it->raster->crs() != mOutputCrs )
{ {
@ -106,7 +106,7 @@ int QgsRasterCalculator::processCalculation( QProgressDialog* p )
//open output dataset for writing //open output dataset for writing
GDALDriverH outputDriver = openOutputDriver(); GDALDriverH outputDriver = openOutputDriver();
if ( outputDriver == NULL ) if ( outputDriver == nullptr )
{ {
return 1; return 1;
} }
@ -194,15 +194,15 @@ GDALDriverH QgsRasterCalculator::openOutputDriver()
//open driver //open driver
GDALDriverH outputDriver = GDALGetDriverByName( mOutputFormat.toLocal8Bit().data() ); GDALDriverH outputDriver = GDALGetDriverByName( mOutputFormat.toLocal8Bit().data() );
if ( outputDriver == NULL ) if ( outputDriver == nullptr )
{ {
return outputDriver; //return NULL, driver does not exist return outputDriver; //return NULL, driver does not exist
} }
driverMetadata = GDALGetMetadata( outputDriver, NULL ); driverMetadata = GDALGetMetadata( outputDriver, nullptr );
if ( !CSLFetchBoolean( driverMetadata, GDAL_DCAP_CREATE, false ) ) if ( !CSLFetchBoolean( driverMetadata, GDAL_DCAP_CREATE, false ) )
{ {
return NULL; //driver exist, but it does not support the create operation return nullptr; //driver exist, but it does not support the create operation
} }
return outputDriver; return outputDriver;
@ -211,9 +211,9 @@ GDALDriverH QgsRasterCalculator::openOutputDriver()
GDALDatasetH QgsRasterCalculator::openOutputFile( GDALDriverH outputDriver ) GDALDatasetH QgsRasterCalculator::openOutputFile( GDALDriverH outputDriver )
{ {
//open output file //open output file
char **papszOptions = NULL; char **papszOptions = nullptr;
GDALDatasetH outputDataset = GDALCreate( outputDriver, TO8F( mOutputFile ), mNumOutputColumns, mNumOutputRows, 1, GDT_Float32, papszOptions ); GDALDatasetH outputDataset = GDALCreate( outputDriver, TO8F( mOutputFile ), mNumOutputColumns, mNumOutputRows, 1, GDT_Float32, papszOptions );
if ( outputDataset == NULL ) if ( outputDataset == nullptr )
{ {
return outputDataset; return outputDataset;
} }

View File

@ -72,7 +72,7 @@ class ANALYSIS_EXPORT QgsRasterCalculator
/** Starts the calculation and writes new raster /** Starts the calculation and writes new raster
@param p progress bar (or 0 if called from non-gui code) @param p progress bar (or 0 if called from non-gui code)
@return 0 in case of success*/ @return 0 in case of success*/
int processCalculation( QProgressDialog* p = 0 ); int processCalculation( QProgressDialog* p = nullptr );
private: private:
//default constructor forbidden. We need formula, output file, output format and output raster resolution obligatory //default constructor forbidden. We need formula, output file, output format and output raster resolution obligatory

View File

@ -22,7 +22,7 @@
QgsRasterMatrix::QgsRasterMatrix() QgsRasterMatrix::QgsRasterMatrix()
: mColumns( 0 ) : mColumns( 0 )
, mRows( 0 ) , mRows( 0 )
, mData( 0 ) , mData( nullptr )
, mNodataValue( -1 ) , mNodataValue( -1 )
{ {
} }
@ -38,7 +38,7 @@ QgsRasterMatrix::QgsRasterMatrix( int nCols, int nRows, double* data, double nod
QgsRasterMatrix::QgsRasterMatrix( const QgsRasterMatrix& m ) QgsRasterMatrix::QgsRasterMatrix( const QgsRasterMatrix& m )
: mColumns( 0 ) : mColumns( 0 )
, mRows( 0 ) , mRows( 0 )
, mData( 0 ) , mData( nullptr )
{ {
operator=( m ); operator=( m );
} }
@ -72,7 +72,7 @@ void QgsRasterMatrix::setData( int cols, int rows, double* data, double nodataVa
double* QgsRasterMatrix::takeData() double* QgsRasterMatrix::takeData()
{ {
double* data = mData; double* data = mData;
mData = 0; mColumns = 0; mRows = 0; mData = nullptr; mColumns = 0; mRows = 0;
return data; return data;
} }

View File

@ -88,20 +88,20 @@ int QgsRelief::processRaster( QProgressDialog* p )
//open input file //open input file
int xSize, ySize; int xSize, ySize;
GDALDatasetH inputDataset = openInputFile( xSize, ySize ); GDALDatasetH inputDataset = openInputFile( xSize, ySize );
if ( inputDataset == NULL ) if ( inputDataset == nullptr )
{ {
return 1; //opening of input file failed return 1; //opening of input file failed
} }
//output driver //output driver
GDALDriverH outputDriver = openOutputDriver(); GDALDriverH outputDriver = openOutputDriver();
if ( outputDriver == 0 ) if ( outputDriver == nullptr )
{ {
return 2; return 2;
} }
GDALDatasetH outputDataset = openOutputFile( inputDataset, outputDriver ); GDALDatasetH outputDataset = openOutputFile( inputDataset, outputDriver );
if ( outputDataset == NULL ) if ( outputDataset == nullptr )
{ {
return 3; //create operation on output file failed return 3; //create operation on output file failed
} }
@ -125,13 +125,13 @@ int QgsRelief::processRaster( QProgressDialog* p )
//open first raster band for reading (operation is only for single band raster) //open first raster band for reading (operation is only for single band raster)
GDALRasterBandH rasterBand = GDALGetRasterBand( inputDataset, 1 ); GDALRasterBandH rasterBand = GDALGetRasterBand( inputDataset, 1 );
if ( rasterBand == NULL ) if ( rasterBand == nullptr )
{ {
GDALClose( inputDataset ); GDALClose( inputDataset );
GDALClose( outputDataset ); GDALClose( outputDataset );
return 4; return 4;
} }
mInputNodataValue = GDALGetRasterNoDataValue( rasterBand, NULL ); mInputNodataValue = GDALGetRasterNoDataValue( rasterBand, nullptr );
mSlopeFilter->setInputNodataValue( mInputNodataValue ); mSlopeFilter->setInputNodataValue( mInputNodataValue );
mAspectFilter->setInputNodataValue( mInputNodataValue ); mAspectFilter->setInputNodataValue( mInputNodataValue );
mHillshadeFilter285->setInputNodataValue( mInputNodataValue ); mHillshadeFilter285->setInputNodataValue( mInputNodataValue );
@ -142,7 +142,7 @@ int QgsRelief::processRaster( QProgressDialog* p )
GDALRasterBandH outputGreenBand = GDALGetRasterBand( outputDataset, 2 ); GDALRasterBandH outputGreenBand = GDALGetRasterBand( outputDataset, 2 );
GDALRasterBandH outputBlueBand = GDALGetRasterBand( outputDataset, 3 ); GDALRasterBandH outputBlueBand = GDALGetRasterBand( outputDataset, 3 );
if ( outputRedBand == NULL || outputGreenBand == NULL || outputBlueBand == NULL ) if ( outputRedBand == nullptr || outputGreenBand == nullptr || outputBlueBand == nullptr )
{ {
GDALClose( inputDataset ); GDALClose( inputDataset );
GDALClose( outputDataset ); GDALClose( outputDataset );
@ -152,7 +152,7 @@ int QgsRelief::processRaster( QProgressDialog* p )
GDALSetRasterNoDataValue( outputRedBand, -9999 ); GDALSetRasterNoDataValue( outputRedBand, -9999 );
GDALSetRasterNoDataValue( outputGreenBand, -9999 ); GDALSetRasterNoDataValue( outputGreenBand, -9999 );
GDALSetRasterNoDataValue( outputBlueBand, -9999 ); GDALSetRasterNoDataValue( outputBlueBand, -9999 );
mOutputNodataValue = GDALGetRasterNoDataValue( outputRedBand, NULL ); mOutputNodataValue = GDALGetRasterNoDataValue( outputRedBand, nullptr );
mSlopeFilter->setOutputNodataValue( mOutputNodataValue ); mSlopeFilter->setOutputNodataValue( mOutputNodataValue );
mAspectFilter->setOutputNodataValue( mOutputNodataValue ); mAspectFilter->setOutputNodataValue( mOutputNodataValue );
mHillshadeFilter285->setOutputNodataValue( mOutputNodataValue ); mHillshadeFilter285->setOutputNodataValue( mOutputNodataValue );
@ -398,7 +398,7 @@ bool QgsRelief::setElevationColor( double elevation, int* red, int* green, int*
GDALDatasetH QgsRelief::openInputFile( int& nCellsX, int& nCellsY ) GDALDatasetH QgsRelief::openInputFile( int& nCellsX, int& nCellsY )
{ {
GDALDatasetH inputDataset = GDALOpen( TO8F( mInputFile ), GA_ReadOnly ); GDALDatasetH inputDataset = GDALOpen( TO8F( mInputFile ), GA_ReadOnly );
if ( inputDataset != NULL ) if ( inputDataset != nullptr )
{ {
nCellsX = GDALGetRasterXSize( inputDataset ); nCellsX = GDALGetRasterXSize( inputDataset );
nCellsY = GDALGetRasterYSize( inputDataset ); nCellsY = GDALGetRasterYSize( inputDataset );
@ -407,7 +407,7 @@ GDALDatasetH QgsRelief::openInputFile( int& nCellsX, int& nCellsY )
if ( GDALGetRasterCount( inputDataset ) < 1 ) if ( GDALGetRasterCount( inputDataset ) < 1 )
{ {
GDALClose( inputDataset ); GDALClose( inputDataset );
return NULL; return nullptr;
} }
} }
return inputDataset; return inputDataset;
@ -420,15 +420,15 @@ GDALDriverH QgsRelief::openOutputDriver()
//open driver //open driver
GDALDriverH outputDriver = GDALGetDriverByName( mOutputFormat.toLocal8Bit().data() ); GDALDriverH outputDriver = GDALGetDriverByName( mOutputFormat.toLocal8Bit().data() );
if ( outputDriver == NULL ) if ( outputDriver == nullptr )
{ {
return outputDriver; //return NULL, driver does not exist return outputDriver; //return NULL, driver does not exist
} }
driverMetadata = GDALGetMetadata( outputDriver, NULL ); driverMetadata = GDALGetMetadata( outputDriver, nullptr );
if ( !CSLFetchBoolean( driverMetadata, GDAL_DCAP_CREATE, false ) ) if ( !CSLFetchBoolean( driverMetadata, GDAL_DCAP_CREATE, false ) )
{ {
return NULL; //driver exist, but it does not support the create operation return nullptr; //driver exist, but it does not support the create operation
} }
return outputDriver; return outputDriver;
@ -436,23 +436,23 @@ GDALDriverH QgsRelief::openOutputDriver()
GDALDatasetH QgsRelief::openOutputFile( GDALDatasetH inputDataset, GDALDriverH outputDriver ) GDALDatasetH QgsRelief::openOutputFile( GDALDatasetH inputDataset, GDALDriverH outputDriver )
{ {
if ( inputDataset == NULL ) if ( inputDataset == nullptr )
{ {
return NULL; return nullptr;
} }
int xSize = GDALGetRasterXSize( inputDataset ); int xSize = GDALGetRasterXSize( inputDataset );
int ySize = GDALGetRasterYSize( inputDataset ); int ySize = GDALGetRasterYSize( inputDataset );
//open output file //open output file
char **papszOptions = NULL; char **papszOptions = nullptr;
//use PACKBITS compression for tiffs by default //use PACKBITS compression for tiffs by default
papszOptions = CSLSetNameValue( papszOptions, "COMPRESS", "PACKBITS" ); papszOptions = CSLSetNameValue( papszOptions, "COMPRESS", "PACKBITS" );
//create three band raster (reg, green, blue) //create three band raster (reg, green, blue)
GDALDatasetH outputDataset = GDALCreate( outputDriver, TO8F( mOutputFile ), xSize, ySize, 3, GDT_Byte, papszOptions ); GDALDatasetH outputDataset = GDALCreate( outputDriver, TO8F( mOutputFile ), xSize, ySize, 3, GDT_Byte, papszOptions );
if ( outputDataset == NULL ) if ( outputDataset == nullptr )
{ {
return outputDataset; return outputDataset;
} }
@ -462,7 +462,7 @@ GDALDatasetH QgsRelief::openOutputFile( GDALDatasetH inputDataset, GDALDriverH o
if ( GDALGetGeoTransform( inputDataset, geotransform ) != CE_None ) if ( GDALGetGeoTransform( inputDataset, geotransform ) != CE_None )
{ {
GDALClose( outputDataset ); GDALClose( outputDataset );
return NULL; return nullptr;
} }
GDALSetGeoTransform( outputDataset, geotransform ); GDALSetGeoTransform( outputDataset, geotransform );
@ -489,14 +489,14 @@ bool QgsRelief::exportFrequencyDistributionToCsv( const QString& file )
{ {
int nCellsX, nCellsY; int nCellsX, nCellsY;
GDALDatasetH inputDataset = openInputFile( nCellsX, nCellsY ); GDALDatasetH inputDataset = openInputFile( nCellsX, nCellsY );
if ( inputDataset == NULL ) if ( inputDataset == nullptr )
{ {
return false; return false;
} }
//open first raster band for reading (elevation raster is always single band) //open first raster band for reading (elevation raster is always single band)
GDALRasterBandH elevationBand = GDALGetRasterBand( inputDataset, 1 ); GDALRasterBandH elevationBand = GDALGetRasterBand( inputDataset, 1 );
if ( elevationBand == NULL ) if ( elevationBand == nullptr )
{ {
GDALClose( inputDataset ); GDALClose( inputDataset );
return false; return false;
@ -572,14 +572,14 @@ QList< QgsRelief::ReliefColor > QgsRelief::calculateOptimizedReliefClasses()
int nCellsX, nCellsY; int nCellsX, nCellsY;
GDALDatasetH inputDataset = openInputFile( nCellsX, nCellsY ); GDALDatasetH inputDataset = openInputFile( nCellsX, nCellsY );
if ( inputDataset == NULL ) if ( inputDataset == nullptr )
{ {
return resultList; return resultList;
} }
//open first raster band for reading (elevation raster is always single band) //open first raster band for reading (elevation raster is always single band)
GDALRasterBandH elevationBand = GDALGetRasterBand( inputDataset, 1 ); GDALRasterBandH elevationBand = GDALGetRasterBand( inputDataset, 1 );
if ( elevationBand == NULL ) if ( elevationBand == nullptr )
{ {
GDALClose( inputDataset ); GDALClose( inputDataset );
return resultList; return resultList;

View File

@ -128,7 +128,7 @@ void QgsGeometryAnalyzer::simplifyFeature( QgsFeature& f, QgsVectorFileWriter* v
} }
const QgsGeometry* featureGeometry = f.constGeometry(); const QgsGeometry* featureGeometry = f.constGeometry();
QgsGeometry* tmpGeometry = 0; QgsGeometry* tmpGeometry = nullptr;
// simplify feature // simplify feature
tmpGeometry = featureGeometry->simplify( tolerance ); tmpGeometry = featureGeometry->simplify( tolerance );
@ -245,7 +245,7 @@ void QgsGeometryAnalyzer::centroidFeature( QgsFeature& f, QgsVectorFileWriter* v
} }
const QgsGeometry* featureGeometry = f.constGeometry(); const QgsGeometry* featureGeometry = f.constGeometry();
QgsGeometry* tmpGeometry = 0; QgsGeometry* tmpGeometry = nullptr;
tmpGeometry = featureGeometry->centroid(); tmpGeometry = featureGeometry->centroid();
@ -391,7 +391,7 @@ bool QgsGeometryAnalyzer::convexHull( QgsVectorLayer* layer, const QString& shap
QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), fields, outputType, &crs ); QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), fields, outputType, &crs );
QgsFeature currentFeature; QgsFeature currentFeature;
QgsGeometry* dissolveGeometry = 0; //dissolve geometry QgsGeometry* dissolveGeometry = nullptr; //dissolve geometry
QMultiMap<QString, QgsFeatureId> map; QMultiMap<QString, QgsFeatureId> map;
if ( onlySelectedFeatures ) if ( onlySelectedFeatures )
@ -552,8 +552,8 @@ void QgsGeometryAnalyzer::convexFeature( QgsFeature& f, int nProcessedFeatures,
} }
const QgsGeometry* featureGeometry = f.constGeometry(); const QgsGeometry* featureGeometry = f.constGeometry();
QgsGeometry* tmpGeometry = 0; QgsGeometry* tmpGeometry = nullptr;
QgsGeometry* convexGeometry = 0; QgsGeometry* convexGeometry = nullptr;
convexGeometry = featureGeometry->convexHull(); convexGeometry = featureGeometry->convexHull();
@ -622,7 +622,7 @@ bool QgsGeometryAnalyzer::dissolve( QgsVectorLayer* layer, const QString& shapef
} }
} }
QgsGeometry *dissolveGeometry = 0; //dissolve geometry QgsGeometry *dissolveGeometry = nullptr; //dissolve geometry
QMultiMap<QString, QgsFeatureId>::const_iterator jt = map.constBegin(); QMultiMap<QString, QgsFeatureId>::const_iterator jt = map.constBegin();
QgsFeature outputFeature; QgsFeature outputFeature;
while ( jt != map.constEnd() ) while ( jt != map.constEnd() )
@ -750,7 +750,7 @@ bool QgsGeometryAnalyzer::buffer( QgsVectorLayer* layer, const QString& shapefil
QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), layer->fields(), outputType, &crs ); QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), layer->fields(), outputType, &crs );
QgsFeature currentFeature; QgsFeature currentFeature;
QgsGeometry *dissolveGeometry = 0; //dissolve geometry (if dissolve enabled) QgsGeometry *dissolveGeometry = nullptr; //dissolve geometry (if dissolve enabled)
//take only selection //take only selection
if ( onlySelectedFeatures ) if ( onlySelectedFeatures )
@ -843,8 +843,8 @@ void QgsGeometryAnalyzer::bufferFeature( QgsFeature& f, int nProcessedFeatures,
double currentBufferDistance; double currentBufferDistance;
const QgsGeometry* featureGeometry = f.constGeometry(); const QgsGeometry* featureGeometry = f.constGeometry();
QgsGeometry* tmpGeometry = 0; QgsGeometry* tmpGeometry = nullptr;
QgsGeometry* bufferGeometry = 0; QgsGeometry* bufferGeometry = nullptr;
//create buffer //create buffer
if ( bufferDistanceField == -1 ) if ( bufferDistanceField == -1 )
@ -904,7 +904,7 @@ bool QgsGeometryAnalyzer::eventLayer( QgsVectorLayer* lineLayer, QgsVectorLayer*
} }
//create output datasource or attributes in memory provider //create output datasource or attributes in memory provider
QgsVectorFileWriter* fileWriter = 0; QgsVectorFileWriter* fileWriter = nullptr;
QgsFeatureList memoryProviderFeatures; QgsFeatureList memoryProviderFeatures;
if ( !memoryProvider ) if ( !memoryProvider )
{ {
@ -931,7 +931,7 @@ bool QgsGeometryAnalyzer::eventLayer( QgsVectorLayer* lineLayer, QgsVectorLayer*
//iterate over eventLayer and write new features to output file or layer //iterate over eventLayer and write new features to output file or layer
fit = eventLayer->getFeatures( QgsFeatureRequest().setFlags( QgsFeatureRequest::NoGeometry ) ); fit = eventLayer->getFeatures( QgsFeatureRequest().setFlags( QgsFeatureRequest::NoGeometry ) );
QgsGeometry* lrsGeom = 0; QgsGeometry* lrsGeom = nullptr;
double measure1, measure2 = 0.0; double measure1, measure2 = 0.0;
int nEventFeatures = eventLayer->featureCount(); int nEventFeatures = eventLayer->featureCount();
@ -1128,7 +1128,7 @@ bool QgsGeometryAnalyzer::createOffsetGeometry( QgsGeometry* geom, QgsGeometry*
{ {
geomArray[i] = outputGeomList.at( i ); geomArray[i] = outputGeomList.at( i );
} }
GEOSGeometry* collection = 0; GEOSGeometry* collection = nullptr;
if ( geom->type() == QGis::Point ) if ( geom->type() == QGis::Point )
{ {
collection = GEOSGeom_createCollection_r( geosctxt, GEOS_MULTIPOINT, geomArray, outputGeomList.size() ); collection = GEOSGeom_createCollection_r( geosctxt, GEOS_MULTIPOINT, geomArray, outputGeomList.size() );
@ -1172,7 +1172,7 @@ QgsGeometry* QgsGeometryAnalyzer::locateBetweenMeasures( double fromMeasure, dou
{ {
if ( !lineGeom ) if ( !lineGeom )
{ {
return 0; return nullptr;
} }
QgsMultiPolyline resultGeom; QgsMultiPolyline resultGeom;
@ -1187,7 +1187,7 @@ QgsGeometry* QgsGeometryAnalyzer::locateBetweenMeasures( double fromMeasure, dou
if ( wkbType != QGis::WKBLineString25D && wkbType != QGis::WKBMultiLineString25D ) if ( wkbType != QGis::WKBLineString25D && wkbType != QGis::WKBMultiLineString25D )
{ {
return 0; return nullptr;
} }
if ( wkbType == QGis::WKBLineString25D ) if ( wkbType == QGis::WKBLineString25D )
@ -1207,7 +1207,7 @@ QgsGeometry* QgsGeometryAnalyzer::locateBetweenMeasures( double fromMeasure, dou
if ( resultGeom.size() < 1 ) if ( resultGeom.size() < 1 )
{ {
return 0; return nullptr;
} }
return QgsGeometry::fromMultiPolyline( resultGeom ); return QgsGeometry::fromMultiPolyline( resultGeom );
} }
@ -1216,7 +1216,7 @@ QgsGeometry* QgsGeometryAnalyzer::locateAlongMeasure( double measure, const QgsG
{ {
if ( !lineGeom ) if ( !lineGeom )
{ {
return 0; return nullptr;
} }
QgsMultiPoint resultGeom; QgsMultiPoint resultGeom;
@ -1231,7 +1231,7 @@ QgsGeometry* QgsGeometryAnalyzer::locateAlongMeasure( double measure, const QgsG
if ( wkbType != QGis::WKBLineString25D && wkbType != QGis::WKBMultiLineString25D ) if ( wkbType != QGis::WKBLineString25D && wkbType != QGis::WKBMultiLineString25D )
{ {
return 0; return nullptr;
} }
if ( wkbType == QGis::WKBLineString25D ) if ( wkbType == QGis::WKBLineString25D )
@ -1251,7 +1251,7 @@ QgsGeometry* QgsGeometryAnalyzer::locateAlongMeasure( double measure, const QgsG
if ( resultGeom.size() < 1 ) if ( resultGeom.size() < 1 )
{ {
return 0; return nullptr;
} }
return QgsGeometry::fromMultiPoint( resultGeom ); return QgsGeometry::fromMultiPoint( resultGeom );
} }

View File

@ -45,7 +45,7 @@ class ANALYSIS_EXPORT QgsGeometryAnalyzer
@param p progress dialog (or 0 if no progress dialog is to be shown) @param p progress dialog (or 0 if no progress dialog is to be shown)
*/ */
bool simplify( QgsVectorLayer* layer, const QString& shapefileName, double tolerance, bool simplify( QgsVectorLayer* layer, const QString& shapefileName, double tolerance,
bool onlySelectedFeatures = false, QProgressDialog* p = 0 ); bool onlySelectedFeatures = false, QProgressDialog* p = nullptr );
/** Calculate the true centroids, or 'center of mass' for a vector layer and /** Calculate the true centroids, or 'center of mass' for a vector layer and
write it to a new shape file write it to a new shape file
@ -55,7 +55,7 @@ class ANALYSIS_EXPORT QgsGeometryAnalyzer
@param p progress dialog (or 0 if no progress dialog is to be shown) @param p progress dialog (or 0 if no progress dialog is to be shown)
*/ */
bool centroids( QgsVectorLayer* layer, const QString& shapefileName, bool centroids( QgsVectorLayer* layer, const QString& shapefileName,
bool onlySelectedFeatures = false, QProgressDialog* p = 0 ); bool onlySelectedFeatures = false, QProgressDialog* p = nullptr );
/** Create a polygon based on the extent of all (selected) features and write it to a new shape file /** Create a polygon based on the extent of all (selected) features and write it to a new shape file
@param layer input vector layer @param layer input vector layer
@ -63,7 +63,7 @@ class ANALYSIS_EXPORT QgsGeometryAnalyzer
@param onlySelectedFeatures if true, only selected features are considered, else all the features @param onlySelectedFeatures if true, only selected features are considered, else all the features
@param p progress dialog (or 0 if no progress dialog is to be shown) @param p progress dialog (or 0 if no progress dialog is to be shown)
*/ */
bool extent( QgsVectorLayer* layer, const QString& shapefileName, bool onlySelectedFeatures = false, QProgressDialog* p = 0 ); bool extent( QgsVectorLayer* layer, const QString& shapefileName, bool onlySelectedFeatures = false, QProgressDialog* p = nullptr );
/** Create buffers for a vector layer and write it to a new shape file /** Create buffers for a vector layer and write it to a new shape file
@param layer input vector layer @param layer input vector layer
@ -75,7 +75,7 @@ class ANALYSIS_EXPORT QgsGeometryAnalyzer
@param p progress dialog (or 0 if no progress dialog is to be shown) @param p progress dialog (or 0 if no progress dialog is to be shown)
*/ */
bool buffer( QgsVectorLayer* layer, const QString& shapefileName, double bufferDistance, bool buffer( QgsVectorLayer* layer, const QString& shapefileName, double bufferDistance,
bool onlySelectedFeatures = false, bool dissolve = false, int bufferDistanceField = -1, QProgressDialog* p = 0 ); bool onlySelectedFeatures = false, bool dissolve = false, int bufferDistanceField = -1, QProgressDialog* p = nullptr );
/** Create convex hull(s) of a vector layer and write it to a new shape file /** Create convex hull(s) of a vector layer and write it to a new shape file
@param layer input vector layer @param layer input vector layer
@ -86,7 +86,7 @@ class ANALYSIS_EXPORT QgsGeometryAnalyzer
@param p progress dialog (or 0 if no progress dialog is to be shown) @param p progress dialog (or 0 if no progress dialog is to be shown)
*/ */
bool convexHull( QgsVectorLayer* layer, const QString& shapefileName, bool onlySelectedFeatures = false, bool convexHull( QgsVectorLayer* layer, const QString& shapefileName, bool onlySelectedFeatures = false,
int uniqueIdField = -1, QProgressDialog* p = 0 ); int uniqueIdField = -1, QProgressDialog* p = nullptr );
/** Dissolve a vector layer and write it to a new shape file /** Dissolve a vector layer and write it to a new shape file
@param layer input vector layer @param layer input vector layer
@ -97,7 +97,7 @@ class ANALYSIS_EXPORT QgsGeometryAnalyzer
@param p progress dialog (or 0 if no progress dialog is to be shown) @param p progress dialog (or 0 if no progress dialog is to be shown)
*/ */
bool dissolve( QgsVectorLayer* layer, const QString& shapefileName, bool onlySelectedFeatures = false, bool dissolve( QgsVectorLayer* layer, const QString& shapefileName, bool onlySelectedFeatures = false,
int uniqueIdField = -1, QProgressDialog* p = 0 ); int uniqueIdField = -1, QProgressDialog* p = nullptr );
/** Creates an event layer (multipoint or multiline) by locating features from a (non-spatial) event table along the features of a line layer. /** Creates an event layer (multipoint or multiline) by locating features from a (non-spatial) event table along the features of a line layer.
Note that currently (until QgsGeometry supports m-values) the z-coordinate of the line layer is used for linear referencing Note that currently (until QgsGeometry supports m-values) the z-coordinate of the line layer is used for linear referencing
@ -118,7 +118,7 @@ class ANALYSIS_EXPORT QgsGeometryAnalyzer
*/ */
bool eventLayer( QgsVectorLayer* lineLayer, QgsVectorLayer* eventLayer, int lineField, int eventField, QgsFeatureIds &unlocatedFeatureIds, const QString& outputLayer, bool eventLayer( QgsVectorLayer* lineLayer, QgsVectorLayer* eventLayer, int lineField, int eventField, QgsFeatureIds &unlocatedFeatureIds, const QString& outputLayer,
const QString& outputFormat, int locationField1, int locationField2 = -1, int offsetField = -1, double offsetScale = 1.0, const QString& outputFormat, int locationField1, int locationField2 = -1, int offsetField = -1, double offsetScale = 1.0,
bool forceSingleGeometry = false, QgsVectorDataProvider* memoryProvider = 0, QProgressDialog* p = 0 ); bool forceSingleGeometry = false, QgsVectorDataProvider* memoryProvider = nullptr, QProgressDialog* p = nullptr );
/** Returns linear reference geometry as a multiline (or 0 if no match). Currently, the z-coordinates are considered to be the measures (no support for m-values in QGIS)*/ /** Returns linear reference geometry as a multiline (or 0 if no match). Currently, the z-coordinates are considered to be the measures (no support for m-values in QGIS)*/
QgsGeometry* locateBetweenMeasures( double fromMeasure, double toMeasure, const QgsGeometry *lineGeom ); QgsGeometry* locateBetweenMeasures( double fromMeasure, double toMeasure, const QgsGeometry *lineGeom );

View File

@ -148,7 +148,7 @@ void QgsOverlayAnalyzer::intersectFeature( QgsFeature& f, QgsVectorFileWriter* v
} }
const QgsGeometry* featureGeometry = f.constGeometry(); const QgsGeometry* featureGeometry = f.constGeometry();
QgsGeometry* intersectGeometry = 0; QgsGeometry* intersectGeometry = nullptr;
QgsFeature overlayFeature; QgsFeature overlayFeature;
QList<QgsFeatureId> intersects; QList<QgsFeatureId> intersects;

View File

@ -46,7 +46,7 @@ class ANALYSIS_EXPORT QgsOverlayAnalyzer
*/ */
bool intersection( QgsVectorLayer* layerA, QgsVectorLayer* layerB, bool intersection( QgsVectorLayer* layerA, QgsVectorLayer* layerB,
const QString& shapefileName, bool onlySelectedFeatures = false, const QString& shapefileName, bool onlySelectedFeatures = false,
QProgressDialog* p = 0 ); QProgressDialog* p = nullptr );
private: private:

View File

@ -13,7 +13,7 @@ QgsPointSample::QgsPointSample( QgsVectorLayer* inputLayer, const QString& outpu
} }
QgsPointSample::QgsPointSample() QgsPointSample::QgsPointSample()
: mInputLayer( NULL ) : mInputLayer( nullptr )
, mNCreatedPoints( 0 ) , mNCreatedPoints( 0 )
{ {
} }

View File

@ -23,8 +23,8 @@ QgsTransectSample::QgsTransectSample( QgsVectorLayer* strataLayer, const QString
} }
QgsTransectSample::QgsTransectSample() QgsTransectSample::QgsTransectSample()
: mStrataLayer( NULL ) : mStrataLayer( nullptr )
, mBaselineLayer( NULL ) , mBaselineLayer( nullptr )
, mShareBaseline( false ) , mShareBaseline( false )
, mMinDistanceUnits( Meters ) , mMinDistanceUnits( Meters )
, mMinTransectLength( 0.0 ) , mMinTransectLength( 0.0 )
@ -330,7 +330,7 @@ QgsGeometry* QgsTransectSample::findBaselineGeometry( const QVariant& strataId )
{ {
if ( !mBaselineLayer ) if ( !mBaselineLayer )
{ {
return 0; return nullptr;
} }
QgsFeatureIterator baseLineIt = mBaselineLayer->getFeatures( QgsFeatureRequest().setSubsetOfAttributes( QStringList( mBaselineStrataId ), mBaselineLayer->fields() ) ); QgsFeatureIterator baseLineIt = mBaselineLayer->getFeatures( QgsFeatureRequest().setSubsetOfAttributes( QStringList( mBaselineStrataId ), mBaselineLayer->fields() ) );
@ -345,7 +345,7 @@ QgsGeometry* QgsTransectSample::findBaselineGeometry( const QVariant& strataId )
Q_NOWARN_DEPRECATED_POP Q_NOWARN_DEPRECATED_POP
} }
} }
return 0; return nullptr;
} }
bool QgsTransectSample::otherTransectWithinDistance( QgsGeometry* geom, double minDistLayerUnit, double minDistance, QgsSpatialIndex& sIndex, bool QgsTransectSample::otherTransectWithinDistance( QgsGeometry* geom, double minDistLayerUnit, double minDistance, QgsSpatialIndex& sIndex,
@ -514,12 +514,12 @@ QgsGeometry* QgsTransectSample::closestMultilineElement( const QgsPoint& pt, Qgs
if ( !multiLine || ( multiLine->wkbType() != QGis::WKBMultiLineString if ( !multiLine || ( multiLine->wkbType() != QGis::WKBMultiLineString
&& multiLine->wkbType() != QGis::WKBMultiLineString25D ) ) && multiLine->wkbType() != QGis::WKBMultiLineString25D ) )
{ {
return 0; return nullptr;
} }
double minDist = DBL_MAX; double minDist = DBL_MAX;
double currentDist = 0; double currentDist = 0;
QgsGeometry* currentLine = 0; QgsGeometry* currentLine = nullptr;
QScopedPointer<QgsGeometry> closestLine; QScopedPointer<QgsGeometry> closestLine;
QgsGeometry* pointGeom = QgsGeometry::fromPoint( pt ); QgsGeometry* pointGeom = QgsGeometry::fromPoint( pt );
@ -548,7 +548,7 @@ QgsGeometry* QgsTransectSample::clipBufferLine( const QgsGeometry* stratumGeom,
{ {
if ( !stratumGeom || !clippedBaseline || clippedBaseline->wkbType() == QGis::WKBUnknown ) if ( !stratumGeom || !clippedBaseline || clippedBaseline->wkbType() == QGis::WKBUnknown )
{ {
return 0; return nullptr;
} }
QgsGeometry* usedBaseline = clippedBaseline; QgsGeometry* usedBaseline = clippedBaseline;
@ -558,7 +558,7 @@ QgsGeometry* QgsTransectSample::clipBufferLine( const QgsGeometry* stratumGeom,
usedBaseline = clippedBaseline->simplify( mBaselineSimplificationTolerance ); usedBaseline = clippedBaseline->simplify( mBaselineSimplificationTolerance );
if ( !usedBaseline ) if ( !usedBaseline )
{ {
return 0; return nullptr;
} }
//int verticesAfter = usedBaseline->asMultiPolyline().count(); //int verticesAfter = usedBaseline->asMultiPolyline().count();
@ -582,8 +582,8 @@ QgsGeometry* QgsTransectSample::clipBufferLine( const QgsGeometry* stratumGeom,
} }
//it is also possible that clipBaselineBuffer is a multipolygon //it is also possible that clipBaselineBuffer is a multipolygon
QgsGeometry* bufferLine = 0; //buffer line or multiline QgsGeometry* bufferLine = nullptr; //buffer line or multiline
QgsGeometry* bufferLineClipped = 0; QgsGeometry* bufferLineClipped = nullptr;
QgsMultiPolyline mpl; QgsMultiPolyline mpl;
if ( clipBaselineBuffer->isMultipart() ) if ( clipBaselineBuffer->isMultipart() )
{ {
@ -665,7 +665,7 @@ QgsGeometry* QgsTransectSample::clipBufferLine( const QgsGeometry* stratumGeom,
{ {
delete usedBaseline; delete usedBaseline;
} }
return 0; //no solution found even with reduced tolerances return nullptr; //no solution found even with reduced tolerances
} }
double QgsTransectSample::bufferDistance( double minDistanceFromAttribute ) const double QgsTransectSample::bufferDistance( double minDistanceFromAttribute ) const

View File

@ -44,7 +44,7 @@ QgsZonalStatistics::QgsZonalStatistics( QgsVectorLayer* polygonLayer, const QStr
QgsZonalStatistics::QgsZonalStatistics() QgsZonalStatistics::QgsZonalStatistics()
: mRasterBand( 0 ) : mRasterBand( 0 )
, mPolygonLayer( 0 ) , mPolygonLayer( nullptr )
, mInputNodataValue( -1 ) , mInputNodataValue( -1 )
, mStatistics( QgsZonalStatistics::All ) , mStatistics( QgsZonalStatistics::All )
{ {
@ -72,7 +72,7 @@ int QgsZonalStatistics::calculateStatistics( QProgressDialog* p )
//open the raster layer and the raster band //open the raster layer and the raster band
GDALAllRegister(); GDALAllRegister();
GDALDatasetH inputDataset = GDALOpen( TO8F( mRasterFilePath ), GA_ReadOnly ); GDALDatasetH inputDataset = GDALOpen( TO8F( mRasterFilePath ), GA_ReadOnly );
if ( inputDataset == NULL ) if ( inputDataset == nullptr )
{ {
return 3; return 3;
} }
@ -84,12 +84,12 @@ int QgsZonalStatistics::calculateStatistics( QProgressDialog* p )
} }
GDALRasterBandH rasterBand = GDALGetRasterBand( inputDataset, mRasterBand ); GDALRasterBandH rasterBand = GDALGetRasterBand( inputDataset, mRasterBand );
if ( rasterBand == NULL ) if ( rasterBand == nullptr )
{ {
GDALClose( inputDataset ); GDALClose( inputDataset );
return 5; return 5;
} }
mInputNodataValue = GDALGetRasterNoDataValue( rasterBand, NULL ); mInputNodataValue = GDALGetRasterNoDataValue( rasterBand, nullptr );
//get geometry info about raster layer //get geometry info about raster layer
int nCellsXGDAL = GDALGetRasterXSize( inputDataset ); int nCellsXGDAL = GDALGetRasterXSize( inputDataset );
@ -431,8 +431,8 @@ void QgsZonalStatistics::statisticsFromMiddlePointTest( void* band, const QgsGeo
return; return;
} }
GEOSCoordSequence* cellCenterCoords = 0; GEOSCoordSequence* cellCenterCoords = nullptr;
GEOSGeometry* currentCellCenter = 0; GEOSGeometry* currentCellCenter = nullptr;
for ( int i = 0; i < nCellsY; ++i ) for ( int i = 0; i < nCellsY; ++i )
{ {
@ -472,7 +472,7 @@ void QgsZonalStatistics::statisticsFromPreciseIntersection( void* band, const Qg
double currentY = rasterBBox.yMaximum() - pixelOffsetY * cellSizeY - cellSizeY / 2; double currentY = rasterBBox.yMaximum() - pixelOffsetY * cellSizeY - cellSizeY / 2;
float* pixelData = ( float * ) CPLMalloc( sizeof( float ) ); float* pixelData = ( float * ) CPLMalloc( sizeof( float ) );
QgsGeometry* pixelRectGeometry = 0; QgsGeometry* pixelRectGeometry = nullptr;
double hCellSizeX = cellSizeX / 2.0; double hCellSizeX = cellSizeX / 2.0;
double hCellSizeY = cellSizeY / 2.0; double hCellSizeY = cellSizeY / 2.0;
@ -504,7 +504,7 @@ void QgsZonalStatistics::statisticsFromPreciseIntersection( void* band, const Qg
delete intersectGeometry; delete intersectGeometry;
} }
delete pixelRectGeometry; delete pixelRectGeometry;
pixelRectGeometry = 0; pixelRectGeometry = nullptr;
} }
currentX += cellSizeX; currentX += cellSizeX;
} }

View File

@ -95,7 +95,7 @@ void QgsAtlasCompositionWidget::changeCoverageLayer( QgsMapLayer *layer )
if ( !vl ) if ( !vl )
{ {
atlasMap->setCoverageLayer( 0 ); atlasMap->setCoverageLayer( nullptr );
} }
else else
{ {
@ -227,7 +227,7 @@ void QgsAtlasCompositionWidget::updateAtlasFeatures()
bool updated = atlasMap->updateFeatures(); bool updated = atlasMap->updateFeatures();
if ( !updated ) if ( !updated )
{ {
QMessageBox::warning( 0, tr( "Atlas preview" ), QMessageBox::warning( nullptr, tr( "Atlas preview" ),
tr( "No matching atlas features found!" ), tr( "No matching atlas features found!" ),
QMessageBox::Ok, QMessageBox::Ok,
QMessageBox::Ok ); QMessageBox::Ok );

View File

@ -273,18 +273,18 @@ QgsAttributeSelectionDialog::QgsAttributeSelectionDialog( QgsComposerAttributeTa
QWidget* parent, Qt::WindowFlags f ) QWidget* parent, Qt::WindowFlags f )
: QDialog( parent, f ) : QDialog( parent, f )
, mComposerTable( table ) , mComposerTable( table )
, mComposerTableV1( NULL ) , mComposerTableV1( nullptr )
, mVectorLayer( vLayer ) , mVectorLayer( vLayer )
, mColumnModel( NULL ) , mColumnModel( nullptr )
, mColumnModelV1( NULL ) , mColumnModelV1( nullptr )
, mSortedProxyModel( NULL ) , mSortedProxyModel( nullptr )
, mSortedProxyModelV1( NULL ) , mSortedProxyModelV1( nullptr )
, mAvailableSortProxyModel( NULL ) , mAvailableSortProxyModel( nullptr )
, mAvailableSortProxyModelV1( NULL ) , mAvailableSortProxyModelV1( nullptr )
, mColumnAlignmentDelegate( NULL ) , mColumnAlignmentDelegate( nullptr )
, mColumnSourceDelegate( NULL ) , mColumnSourceDelegate( nullptr )
, mColumnSortOrderDelegate( NULL ) , mColumnSortOrderDelegate( nullptr )
, mColumnWidthDelegate( NULL ) , mColumnWidthDelegate( nullptr )
{ {
setupUi( this ); setupUi( this );
@ -327,19 +327,19 @@ QgsAttributeSelectionDialog::QgsAttributeSelectionDialog( QgsComposerAttributeTa
QgsAttributeSelectionDialog::QgsAttributeSelectionDialog( QgsComposerAttributeTable *table, QgsVectorLayer *vLayer, QWidget *parent, Qt::WindowFlags f ) QgsAttributeSelectionDialog::QgsAttributeSelectionDialog( QgsComposerAttributeTable *table, QgsVectorLayer *vLayer, QWidget *parent, Qt::WindowFlags f )
: QDialog( parent, f ) : QDialog( parent, f )
, mComposerTable( NULL ) , mComposerTable( nullptr )
, mComposerTableV1( table ) , mComposerTableV1( table )
, mVectorLayer( vLayer ) , mVectorLayer( vLayer )
, mColumnModel( NULL ) , mColumnModel( nullptr )
, mColumnModelV1( NULL ) , mColumnModelV1( nullptr )
, mSortedProxyModel( NULL ) , mSortedProxyModel( nullptr )
, mSortedProxyModelV1( NULL ) , mSortedProxyModelV1( nullptr )
, mAvailableSortProxyModel( NULL ) , mAvailableSortProxyModel( nullptr )
, mAvailableSortProxyModelV1( NULL ) , mAvailableSortProxyModelV1( nullptr )
, mColumnAlignmentDelegate( NULL ) , mColumnAlignmentDelegate( nullptr )
, mColumnSourceDelegate( NULL ) , mColumnSourceDelegate( nullptr )
, mColumnSortOrderDelegate( NULL ) , mColumnSortOrderDelegate( nullptr )
, mColumnWidthDelegate( NULL ) , mColumnWidthDelegate( nullptr )
{ {
setupUi( this ); setupUi( this );
@ -532,7 +532,7 @@ void QgsAttributeSelectionDialog::on_mRemoveSortColumnPushButton_clicked()
int rowToRemove = selectedIndex.row(); int rowToRemove = selectedIndex.row();
//find corresponding column //find corresponding column
QgsComposerTableColumn * column = 0; QgsComposerTableColumn * column = nullptr;
if ( mComposerTable ) if ( mComposerTable )
{ {
column = mSortedProxyModel->columnFromIndex( selectedIndex ); column = mSortedProxyModel->columnFromIndex( selectedIndex );

View File

@ -44,7 +44,7 @@ class QgsComposerColumnAlignmentDelegate : public QItemDelegate
Q_OBJECT Q_OBJECT
public: public:
explicit QgsComposerColumnAlignmentDelegate( QObject *parent = 0 ); explicit QgsComposerColumnAlignmentDelegate( QObject *parent = nullptr );
QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override; QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
void setEditorData( QWidget *editor, const QModelIndex &index ) const override; void setEditorData( QWidget *editor, const QModelIndex &index ) const override;
void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override; void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;
@ -61,7 +61,7 @@ class QgsComposerColumnSourceDelegate : public QItemDelegate
Q_OBJECT Q_OBJECT
public: public:
QgsComposerColumnSourceDelegate( QgsVectorLayer* vlayer, QObject *parent = 0, const QgsComposerObject* composerObject = 0 ); QgsComposerColumnSourceDelegate( QgsVectorLayer* vlayer, QObject *parent = nullptr, const QgsComposerObject* composerObject = nullptr );
QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override; QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
void setEditorData( QWidget *editor, const QModelIndex &index ) const override; void setEditorData( QWidget *editor, const QModelIndex &index ) const override;
void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override; void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;
@ -81,7 +81,7 @@ class QgsComposerColumnWidthDelegate : public QItemDelegate
Q_OBJECT Q_OBJECT
public: public:
explicit QgsComposerColumnWidthDelegate( QObject *parent = 0 ); explicit QgsComposerColumnWidthDelegate( QObject *parent = nullptr );
QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override; QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
void setEditorData( QWidget *editor, const QModelIndex &index ) const override; void setEditorData( QWidget *editor, const QModelIndex &index ) const override;
void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override; void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;
@ -98,7 +98,7 @@ class QgsComposerColumnSortOrderDelegate : public QItemDelegate
Q_OBJECT Q_OBJECT
public: public:
explicit QgsComposerColumnSortOrderDelegate( QObject *parent = 0 ); explicit QgsComposerColumnSortOrderDelegate( QObject *parent = nullptr );
QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override; QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
void setEditorData( QWidget *editor, const QModelIndex &index ) const override; void setEditorData( QWidget *editor, const QModelIndex &index ) const override;
void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override; void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;
@ -114,10 +114,10 @@ class QgsAttributeSelectionDialog: public QDialog, private Ui::QgsAttributeSelec
{ {
Q_OBJECT Q_OBJECT
public: public:
QgsAttributeSelectionDialog( QgsComposerAttributeTableV2* table, QgsVectorLayer* vLayer, QWidget * parent = 0, Qt::WindowFlags f = 0 ); QgsAttributeSelectionDialog( QgsComposerAttributeTableV2* table, QgsVectorLayer* vLayer, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr );
//todo - remove for QGIS 3.0 //todo - remove for QGIS 3.0
QgsAttributeSelectionDialog( QgsComposerAttributeTable* table, QgsVectorLayer* vLayer, QWidget * parent = 0, Qt::WindowFlags f = 0 ); QgsAttributeSelectionDialog( QgsComposerAttributeTable* table, QgsVectorLayer* vLayer, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr );
~QgsAttributeSelectionDialog(); ~QgsAttributeSelectionDialog();

View File

@ -107,10 +107,10 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
: QMainWindow() : QMainWindow()
, mTitle( title ) , mTitle( title )
, mQgis( qgis ) , mQgis( qgis )
, mPrinter( 0 ) , mPrinter( nullptr )
, mSetPageOrientation( false ) , mSetPageOrientation( false )
, mUndoView( 0 ) , mUndoView( nullptr )
, mAtlasFeatureAction( 0 ) , mAtlasFeatureAction( nullptr )
{ {
setupUi( this ); setupUi( this );
setWindowTitle( mTitle ); setWindowTitle( mTitle );
@ -455,7 +455,7 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
mStatusZoomCombo = new QComboBox( mStatusBar ); mStatusZoomCombo = new QComboBox( mStatusBar );
mStatusZoomCombo->setEditable( true ); mStatusZoomCombo->setEditable( true );
mStatusZoomCombo->setInsertPolicy( QComboBox::NoInsert ); mStatusZoomCombo->setInsertPolicy( QComboBox::NoInsert );
mStatusZoomCombo->setCompleter( 0 ); mStatusZoomCombo->setCompleter( nullptr );
mStatusZoomCombo->setMinimumWidth( 100 ); mStatusZoomCombo->setMinimumWidth( 100 );
//zoom combo box accepts decimals in the range 1-9999, with an optional decimal point and "%" sign //zoom combo box accepts decimals in the range 1-9999, with an optional decimal point and "%" sign
QRegExp zoomRx( "\\s*\\d{1,4}(\\.\\d?)?\\s*%?" ); QRegExp zoomRx( "\\s*\\d{1,4}(\\.\\d?)?\\s*%?" );
@ -494,7 +494,7 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
mStatusBar->addWidget( mStatusAtlasLabel ); mStatusBar->addWidget( mStatusAtlasLabel );
//create composer view and layout with rulers //create composer view and layout with rulers
mView = 0; mView = nullptr;
mViewLayout = new QGridLayout(); mViewLayout = new QGridLayout();
mViewLayout->setSpacing( 0 ); mViewLayout->setSpacing( 0 );
mViewLayout->setMargin( 0 ); mViewLayout->setMargin( 0 );
@ -951,7 +951,7 @@ void QgsComposer::showItemOptions( QgsComposerItem* item )
if ( !item ) if ( !item )
{ {
mItemDock->setWidget( 0 ); mItemDock->setWidget( nullptr );
return; return;
} }
@ -1052,7 +1052,7 @@ void QgsComposer::on_mActionAtlasPreview_triggered( bool checked )
if ( checked && !atlasMap->enabled() ) if ( checked && !atlasMap->enabled() )
{ {
//no atlas current enabled //no atlas current enabled
QMessageBox::warning( 0, tr( "Enable atlas preview" ), QMessageBox::warning( nullptr, tr( "Enable atlas preview" ),
tr( "Atlas in not currently enabled for this composition!" ), tr( "Atlas in not currently enabled for this composition!" ),
QMessageBox::Ok, QMessageBox::Ok,
QMessageBox::Ok ); QMessageBox::Ok );
@ -1079,7 +1079,7 @@ void QgsComposer::on_mActionAtlasPreview_triggered( bool checked )
if ( !previewEnabled ) if ( !previewEnabled )
{ {
//something went wrong, eg, no matching features //something went wrong, eg, no matching features
QMessageBox::warning( 0, tr( "Enable atlas preview" ), QMessageBox::warning( nullptr, tr( "Enable atlas preview" ),
tr( "No matching atlas features found!" ), tr( "No matching atlas features found!" ),
QMessageBox::Ok, QMessageBox::Ok,
QMessageBox::Ok ); QMessageBox::Ok );
@ -1643,7 +1643,7 @@ void QgsComposer::exportCompositionAsPDF( QgsComposer::OutputMode mode )
{ {
if ( atlasMap->filenamePattern().isEmpty() ) if ( atlasMap->filenamePattern().isEmpty() )
{ {
int res = QMessageBox::warning( 0, tr( "Empty filename pattern" ), int res = QMessageBox::warning( nullptr, tr( "Empty filename pattern" ),
tr( "The filename pattern is empty. A default one will be used." ), tr( "The filename pattern is empty. A default one will be used." ),
QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok | QMessageBox::Cancel,
QMessageBox::Ok ); QMessageBox::Ok );
@ -1667,7 +1667,7 @@ void QgsComposer::exportCompositionAsPDF( QgsComposer::OutputMode mode )
// test directory (if it exists and is writable) // test directory (if it exists and is writable)
if ( !QDir( outputDir ).exists() || !QFileInfo( outputDir ).isWritable() ) if ( !QDir( outputDir ).exists() || !QFileInfo( outputDir ).isWritable() )
{ {
QMessageBox::warning( 0, tr( "Unable to write into the directory" ), QMessageBox::warning( nullptr, tr( "Unable to write into the directory" ),
tr( "The given output directory is not writable. Cancelling." ), tr( "The given output directory is not writable. Cancelling." ),
QMessageBox::Ok, QMessageBox::Ok,
QMessageBox::Ok ); QMessageBox::Ok );
@ -1845,7 +1845,7 @@ void QgsComposer::printComposition( QgsComposer::OutputMode mode )
//set printer page orientation //set printer page orientation
setPrinterPageOrientation(); setPrinterPageOrientation();
QPrintDialog printDialog( printer(), 0 ); QPrintDialog printDialog( printer(), nullptr );
if ( printDialog.exec() != QDialog::Accepted ) if ( printDialog.exec() != QDialog::Accepted )
{ {
return; return;
@ -1965,7 +1965,7 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode )
if ( memuse > 200 ) // about 4500x4500 if ( memuse > 200 ) // about 4500x4500
{ {
int answer = QMessageBox::warning( 0, tr( "Big image" ), int answer = QMessageBox::warning( nullptr, tr( "Big image" ),
tr( "To create image %1x%2 requires about %3 MB of memory. Proceed?" ) tr( "To create image %1x%2 requires about %3 MB of memory. Proceed?" )
.arg( width ).arg( height ).arg( memuse ), .arg( width ).arg( height ).arg( memuse ),
QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok ); QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok );
@ -2070,7 +2070,7 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode )
if ( image.isNull() ) if ( image.isNull() )
{ {
QMessageBox::warning( 0, tr( "Memory Allocation Error" ), QMessageBox::warning( nullptr, tr( "Memory Allocation Error" ),
tr( "Trying to create image #%1( %2x%3 @ %4dpi ) " tr( "Trying to create image #%1( %2x%3 @ %4dpi ) "
"may result in a memory overflow.\n" "may result in a memory overflow.\n"
"Please try a lower resolution or a smaller papersize" ) "Please try a lower resolution or a smaller papersize" )
@ -2129,7 +2129,7 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode )
// else, it has an atlas to render, so a directory must first be selected // else, it has an atlas to render, so a directory must first be selected
if ( atlasMap->filenamePattern().isEmpty() ) if ( atlasMap->filenamePattern().isEmpty() )
{ {
int res = QMessageBox::warning( 0, tr( "Empty filename pattern" ), int res = QMessageBox::warning( nullptr, tr( "Empty filename pattern" ),
tr( "The filename pattern is empty. A default one will be used." ), tr( "The filename pattern is empty. A default one will be used." ),
QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok | QMessageBox::Cancel,
QMessageBox::Ok ); QMessageBox::Ok );
@ -2194,7 +2194,7 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode )
// test directory (if it exists and is writable) // test directory (if it exists and is writable)
if ( !QDir( dir ).exists() || !QFileInfo( dir ).isWritable() ) if ( !QDir( dir ).exists() || !QFileInfo( dir ).isWritable() )
{ {
QMessageBox::warning( 0, tr( "Unable to write into the directory" ), QMessageBox::warning( nullptr, tr( "Unable to write into the directory" ),
tr( "The given output directory is not writable. Cancelling." ), tr( "The given output directory is not writable. Cancelling." ),
QMessageBox::Ok, QMessageBox::Ok,
QMessageBox::Ok ); QMessageBox::Ok );
@ -2486,7 +2486,7 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
// If we have an Atlas // If we have an Atlas
if ( atlasMap->filenamePattern().isEmpty() ) if ( atlasMap->filenamePattern().isEmpty() )
{ {
int res = QMessageBox::warning( 0, tr( "Empty filename pattern" ), int res = QMessageBox::warning( nullptr, tr( "Empty filename pattern" ),
tr( "The filename pattern is empty. A default one will be used." ), tr( "The filename pattern is empty. A default one will be used." ),
QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok | QMessageBox::Cancel,
QMessageBox::Ok ); QMessageBox::Ok );
@ -2513,7 +2513,7 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
// test directory (if it exists and is writable) // test directory (if it exists and is writable)
if ( !QDir( outputDir ).exists() || !QFileInfo( outputDir ).isWritable() ) if ( !QDir( outputDir ).exists() || !QFileInfo( outputDir ).isWritable() )
{ {
QMessageBox::warning( 0, tr( "Unable to write into the directory" ), QMessageBox::warning( nullptr, tr( "Unable to write into the directory" ),
tr( "The given output directory is not writable. Cancelling." ), tr( "The given output directory is not writable. Cancelling." ),
QMessageBox::Ok, QMessageBox::Ok,
QMessageBox::Ok ); QMessageBox::Ok );
@ -2787,7 +2787,7 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
QString errorMsg; QString errorMsg;
int errorLine; int errorLine;
if ( ! doc.setContent( &svgBuffer, false, &errorMsg, &errorLine ) ) if ( ! doc.setContent( &svgBuffer, false, &errorMsg, &errorLine ) )
QMessageBox::warning( 0, tr( "SVG error" ), tr( "There was an error in SVG output for SVG layer " ) + layerName + tr( " on page " ) + QString::number( i + 1 ) + '(' + errorMsg + ')' ); QMessageBox::warning( nullptr, tr( "SVG error" ), tr( "There was an error in SVG output for SVG layer " ) + layerName + tr( " on page " ) + QString::number( i + 1 ) + '(' + errorMsg + ')' );
if ( 1 == svgLayerId ) if ( 1 == svgLayerId )
{ {
svg = QDomDocument( doc.doctype() ); svg = QDomDocument( doc.doctype() );
@ -2977,7 +2977,7 @@ void QgsComposer::on_mActionDuplicateComposer_triggered()
dlg->close(); dlg->close();
delete dlg; delete dlg;
dlg = 0; dlg = nullptr;
if ( !newComposer ) if ( !newComposer )
{ {
@ -3031,7 +3031,7 @@ void QgsComposer::on_mActionSaveAsTemplate_triggered()
if ( templateFile.write( saveDocument.toByteArray() ) == -1 ) if ( templateFile.write( saveDocument.toByteArray() ) == -1 )
{ {
QMessageBox::warning( 0, tr( "Save error" ), tr( "Error, could not save file" ) ); QMessageBox::warning( nullptr, tr( "Save error" ), tr( "Error, could not save file" ) );
} }
} }
@ -3044,7 +3044,7 @@ void QgsComposer::loadTemplate( const bool newComposer )
{ {
QSettings settings; QSettings settings;
QString openFileDir = settings.value( "UI/lastComposerTemplateDir", QDir::homePath() ).toString(); QString openFileDir = settings.value( "UI/lastComposerTemplateDir", QDir::homePath() ).toString();
QString openFileString = QFileDialog::getOpenFileName( 0, tr( "Load template" ), openFileDir, "*.qpt" ); QString openFileString = QFileDialog::getOpenFileName( nullptr, tr( "Load template" ), openFileDir, "*.qpt" );
if ( openFileString.isEmpty() ) if ( openFileString.isEmpty() )
{ {
@ -3061,8 +3061,8 @@ void QgsComposer::loadTemplate( const bool newComposer )
return; return;
} }
QgsComposer* c = 0; QgsComposer* c = nullptr;
QgsComposition* comp = 0; QgsComposition* comp = nullptr;
if ( newComposer ) if ( newComposer )
{ {
@ -3096,12 +3096,12 @@ void QgsComposer::loadTemplate( const bool newComposer )
dlg->show(); dlg->show();
c->setUpdatesEnabled( false ); c->setUpdatesEnabled( false );
comp->loadFromTemplate( templateDoc, 0, false, newComposer ); comp->loadFromTemplate( templateDoc, nullptr, false, newComposer );
c->setUpdatesEnabled( true ); c->setUpdatesEnabled( true );
dlg->close(); dlg->close();
delete dlg; delete dlg;
dlg = 0; dlg = nullptr;
} }
} }
} }
@ -3538,7 +3538,7 @@ void QgsComposer::readXML( const QDomElement& composerElem, const QDomDocument&
if ( mComposition->generateWorldFile() ) if ( mComposition->generateWorldFile() )
{ {
QDomElement compositionElem = compositionNodeList.at( 0 ).toElement(); QDomElement compositionElem = compositionNodeList.at( 0 ).toElement();
QgsComposerMap* worldFileMap = 0; QgsComposerMap* worldFileMap = nullptr;
QList<const QgsComposerMap*> maps = mComposition->composerMapItems(); QList<const QgsComposerMap*> maps = mComposition->composerMapItems();
for ( QList<const QgsComposerMap*>::const_iterator it = maps.begin(); it != maps.end(); ++it ) for ( QList<const QgsComposerMap*>::const_iterator it = maps.begin(); it != maps.end(); ++it )
{ {
@ -3776,8 +3776,8 @@ void QgsComposer::setSelectionTool()
bool QgsComposer::containsWMSLayer() const bool QgsComposer::containsWMSLayer() const
{ {
QMap<QgsComposerItem*, QWidget*>::const_iterator item_it = mItemWidgetMap.constBegin(); QMap<QgsComposerItem*, QWidget*>::const_iterator item_it = mItemWidgetMap.constBegin();
QgsComposerItem* currentItem = 0; QgsComposerItem* currentItem = nullptr;
QgsComposerMap* currentMap = 0; QgsComposerMap* currentMap = nullptr;
for ( ; item_it != mItemWidgetMap.constEnd(); ++item_it ) for ( ; item_it != mItemWidgetMap.constEnd(); ++item_it )
{ {
@ -3798,8 +3798,8 @@ bool QgsComposer::containsAdvancedEffects() const
{ {
// Check if composer contains any blend modes or flattened layers for transparency // Check if composer contains any blend modes or flattened layers for transparency
QMap<QgsComposerItem*, QWidget*>::const_iterator item_it = mItemWidgetMap.constBegin(); QMap<QgsComposerItem*, QWidget*>::const_iterator item_it = mItemWidgetMap.constBegin();
QgsComposerItem* currentItem = 0; QgsComposerItem* currentItem = nullptr;
QgsComposerMap* currentMap = 0; QgsComposerMap* currentMap = nullptr;
for ( ; item_it != mItemWidgetMap.constEnd(); ++item_it ) for ( ; item_it != mItemWidgetMap.constEnd(); ++item_it )
{ {
@ -4085,7 +4085,7 @@ void QgsComposer::updateAtlasMapLayerAction( QgsVectorLayer *coverageLayer )
if ( mAtlasFeatureAction ) if ( mAtlasFeatureAction )
{ {
delete mAtlasFeatureAction; delete mAtlasFeatureAction;
mAtlasFeatureAction = 0; mAtlasFeatureAction = nullptr;
} }
if ( coverageLayer ) if ( coverageLayer )
@ -4129,7 +4129,7 @@ void QgsComposer::updateAtlasMapLayerAction( bool atlasEnabled )
if ( mAtlasFeatureAction ) if ( mAtlasFeatureAction )
{ {
delete mAtlasFeatureAction; delete mAtlasFeatureAction;
mAtlasFeatureAction = 0; mAtlasFeatureAction = nullptr;
} }
if ( atlasEnabled ) if ( atlasEnabled )

View File

@ -25,7 +25,7 @@
#include <QFileDialog> #include <QFileDialog>
#include <QFileInfo> #include <QFileInfo>
QgsComposerArrowWidget::QgsComposerArrowWidget( QgsComposerArrow* arrow ): QgsComposerItemBaseWidget( 0, arrow ), mArrow( arrow ) QgsComposerArrowWidget::QgsComposerArrowWidget( QgsComposerArrow* arrow ): QgsComposerItemBaseWidget( nullptr, arrow ), mArrow( arrow )
{ {
setupUi( this ); setupUi( this );
mRadioButtonGroup = new QButtonGroup( this ); mRadioButtonGroup = new QButtonGroup( this );
@ -310,7 +310,7 @@ void QgsComposerArrowWidget::on_mLineStyleButton_clicked()
} }
QgsLineSymbolV2* newSymbol = mArrow->lineSymbol()->clone(); QgsLineSymbolV2* newSymbol = mArrow->lineSymbol()->clone();
QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), 0, this ); QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), nullptr, this );
d.setExpressionContext( mArrow->createExpressionContext() ); d.setExpressionContext( mArrow->createExpressionContext() );
if ( d.exec() == QDialog::Accepted ) if ( d.exec() == QDialog::Accepted )

View File

@ -32,7 +32,7 @@
#include "qgscomposertablebackgroundcolorsdialog.h" #include "qgscomposertablebackgroundcolorsdialog.h"
QgsComposerAttributeTableWidget::QgsComposerAttributeTableWidget( QgsComposerAttributeTableV2* table, QgsComposerFrame* frame ) QgsComposerAttributeTableWidget::QgsComposerAttributeTableWidget( QgsComposerAttributeTableV2* table, QgsComposerFrame* frame )
: QgsComposerItemBaseWidget( 0, table ) : QgsComposerItemBaseWidget( nullptr, table )
, mComposerTable( table ) , mComposerTable( table )
, mFrame( frame ) , mFrame( frame )
{ {

View File

@ -26,7 +26,7 @@
QgsComposerHtmlWidget::QgsComposerHtmlWidget( QgsComposerHtml* html, QgsComposerFrame* frame ) QgsComposerHtmlWidget::QgsComposerHtmlWidget( QgsComposerHtml* html, QgsComposerFrame* frame )
: QgsComposerItemBaseWidget( 0, html ) : QgsComposerItemBaseWidget( nullptr, html )
, mHtml( html ) , mHtml( html )
, mFrame( frame ) , mFrame( frame )
{ {
@ -80,11 +80,11 @@ QgsComposerHtmlWidget::QgsComposerHtmlWidget( QgsComposerHtml* html, QgsComposer
} }
QgsComposerHtmlWidget::QgsComposerHtmlWidget() QgsComposerHtmlWidget::QgsComposerHtmlWidget()
: QgsComposerItemBaseWidget( 0, 0 ) : QgsComposerItemBaseWidget( nullptr, nullptr )
, mHtml( NULL ) , mHtml( nullptr )
, mFrame( NULL ) , mFrame( nullptr )
, mHtmlEditor( NULL ) , mHtmlEditor( nullptr )
, mStylesheetEditor( NULL ) , mStylesheetEditor( nullptr )
{ {
} }

View File

@ -36,7 +36,7 @@ class QgsComposerImageExportOptionsDialog: public QDialog, private Ui::QgsCompos
* @param parent parent widget * @param parent parent widget
* @param flags window flags * @param flags window flags
*/ */
QgsComposerImageExportOptionsDialog( QWidget* parent = 0, Qt::WindowFlags flags = 0 ); QgsComposerImageExportOptionsDialog( QWidget* parent = nullptr, Qt::WindowFlags flags = nullptr );
~QgsComposerImageExportOptionsDialog(); ~QgsComposerImageExportOptionsDialog();

View File

@ -81,14 +81,14 @@ QgsAtlasComposition* QgsComposerItemBaseWidget::atlasComposition() const
{ {
if ( !mComposerObject ) if ( !mComposerObject )
{ {
return 0; return nullptr;
} }
QgsComposition* composition = mComposerObject->composition(); QgsComposition* composition = mComposerObject->composition();
if ( !composition ) if ( !composition )
{ {
return 0; return nullptr;
} }
return &composition->atlasComposition(); return &composition->atlasComposition();
@ -103,7 +103,7 @@ QgsVectorLayer* QgsComposerItemBaseWidget::atlasCoverageLayer() const
return atlasMap->coverageLayer(); return atlasMap->coverageLayer();
} }
return 0; return nullptr;
} }
@ -185,8 +185,8 @@ QgsComposerItemWidget::QgsComposerItemWidget( QWidget* parent, QgsComposerItem*
} }
QgsComposerItemWidget::QgsComposerItemWidget() QgsComposerItemWidget::QgsComposerItemWidget()
: QgsComposerItemBaseWidget( 0, 0 ) : QgsComposerItemBaseWidget( nullptr, nullptr )
, mItem( NULL ) , mItem( nullptr )
, mFreezeXPosSpin( false ) , mFreezeXPosSpin( false )
, mFreezeYPosSpin( false ) , mFreezeYPosSpin( false )
, mFreezeWidthSpin( false ) , mFreezeWidthSpin( false )

View File

@ -25,7 +25,7 @@
#include <QFontDialog> #include <QFontDialog>
#include <QWidget> #include <QWidget>
QgsComposerLabelWidget::QgsComposerLabelWidget( QgsComposerLabel* label ): QgsComposerItemBaseWidget( 0, label ), mComposerLabel( label ) QgsComposerLabelWidget::QgsComposerLabelWidget( QgsComposerLabel* label ): QgsComposerItemBaseWidget( nullptr, label ), mComposerLabel( label )
{ {
setupUi( this ); setupUi( this );

View File

@ -28,7 +28,7 @@ QgsComposerLegendItemDialog::QgsComposerLegendItemDialog( const QStandardItem* i
} }
} }
QgsComposerLegendItemDialog::QgsComposerLegendItemDialog(): QDialog( 0 ) QgsComposerLegendItemDialog::QgsComposerLegendItemDialog(): QDialog( nullptr )
{ {
} }

View File

@ -31,7 +31,7 @@ class QgsComposerLegendItemDialog: public QDialog, private Ui::QgsComposerLegend
Q_OBJECT Q_OBJECT
public: public:
QgsComposerLegendItemDialog( const QStandardItem* item, QWidget* parent = 0 ); QgsComposerLegendItemDialog( const QStandardItem* item, QWidget* parent = nullptr );
~QgsComposerLegendItemDialog(); ~QgsComposerLegendItemDialog();
/** Returns the item text inserted by user*/ /** Returns the item text inserted by user*/

View File

@ -28,7 +28,7 @@ QgsComposerLegendLayersDialog::QgsComposerLegendLayersDialog( QList<QgsMapLayer*
} }
} }
QgsComposerLegendLayersDialog::QgsComposerLegendLayersDialog(): QDialog( 0 ) QgsComposerLegendLayersDialog::QgsComposerLegendLayersDialog(): QDialog( nullptr )
{ {
} }
@ -43,11 +43,11 @@ QgsMapLayer* QgsComposerLegendLayersDialog::selectedLayer()
QListWidgetItem* item = listMapLayers->currentItem(); QListWidgetItem* item = listMapLayers->currentItem();
if ( !item ) if ( !item )
{ {
return 0; return nullptr;
} }
QMap<QListWidgetItem*, QgsMapLayer*>::iterator it = mItemLayerMap.find( item ); QMap<QListWidgetItem*, QgsMapLayer*>::iterator it = mItemLayerMap.find( item );
QgsMapLayer* c = 0; QgsMapLayer* c = nullptr;
c = it.value(); c = it.value();
return c; return c;
} }

View File

@ -26,7 +26,7 @@ class QgsComposerLegendLayersDialog: public QDialog, private Ui::QgsComposerLege
Q_OBJECT Q_OBJECT
public: public:
QgsComposerLegendLayersDialog( QList<QgsMapLayer*> layers, QWidget* parent = 0 ); QgsComposerLegendLayersDialog( QList<QgsMapLayer*> layers, QWidget* parent = nullptr );
~QgsComposerLegendLayersDialog(); ~QgsComposerLegendLayersDialog();
QgsMapLayer* selectedLayer(); QgsMapLayer* selectedLayer();

View File

@ -44,7 +44,7 @@
QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend* legend ) QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend* legend )
: QgsComposerItemBaseWidget( 0, legend ) : QgsComposerItemBaseWidget( nullptr, legend )
, mLegend( legend ) , mLegend( legend )
{ {
setupUi( this ); setupUi( this );
@ -88,7 +88,7 @@ QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend* legend )
this, SLOT( selectedChanged( const QModelIndex &, const QModelIndex & ) ) ); this, SLOT( selectedChanged( const QModelIndex &, const QModelIndex & ) ) );
} }
QgsComposerLegendWidget::QgsComposerLegendWidget(): QgsComposerItemBaseWidget( 0, 0 ), mLegend( 0 ) QgsComposerLegendWidget::QgsComposerLegendWidget(): QgsComposerItemBaseWidget( nullptr, nullptr ), mLegend( nullptr )
{ {
setupUi( this ); setupUi( this );
} }
@ -575,7 +575,7 @@ void QgsComposerLegendWidget::on_mMapComboBox_currentIndexChanged( int index )
int mapNr = itemData.toInt(); int mapNr = itemData.toInt();
if ( mapNr < 0 ) if ( mapNr < 0 )
{ {
mLegend->setComposerMap( 0 ); mLegend->setComposerMap( nullptr );
} }
else else
{ {
@ -797,7 +797,7 @@ void QgsComposerLegendWidget::resetLayerNodeToDefaults()
return; return;
} }
QgsLayerTreeLayer* nodeLayer = 0; QgsLayerTreeLayer* nodeLayer = nullptr;
if ( QgsLayerTreeNode* node = mItemTreeView->layerTreeModel()->index2node( currentIndex ) ) if ( QgsLayerTreeNode* node = mItemTreeView->layerTreeModel()->index2node( currentIndex ) )
{ {
if ( QgsLayerTree::isLayer( node ) ) if ( QgsLayerTree::isLayer( node ) )
@ -1066,10 +1066,10 @@ QgsComposerLegendMenuProvider::QgsComposerLegendMenuProvider( QgsLayerTreeView*
QMenu*QgsComposerLegendMenuProvider::createContextMenu() QMenu*QgsComposerLegendMenuProvider::createContextMenu()
{ {
if ( !mView->currentNode() ) if ( !mView->currentNode() )
return 0; return nullptr;
if ( mWidget->legend()->autoUpdateModel() ) if ( mWidget->legend()->autoUpdateModel() )
return 0; // no editing allowed return nullptr; // no editing allowed
QMenu* menu = new QMenu(); QMenu* menu = new QMenu();

View File

@ -264,7 +264,7 @@ void QgsComposerManager::on_mAddButton_clicked()
} }
} }
QgsComposer* newComposer = 0; QgsComposer* newComposer = nullptr;
bool loadedOK = false; bool loadedOK = false;
QString title; QString title;
@ -296,12 +296,12 @@ void QgsComposerManager::on_mAddButton_clicked()
dlg->show(); dlg->show();
newComposer->hide(); newComposer->hide();
loadedOK = newComposer->composition()->loadFromTemplate( templateDoc, 0, false ); loadedOK = newComposer->composition()->loadFromTemplate( templateDoc, nullptr, false );
newComposer->activate(); newComposer->activate();
dlg->close(); dlg->close();
delete dlg; delete dlg;
dlg = 0; dlg = nullptr;
} }
} }
@ -309,7 +309,7 @@ void QgsComposerManager::on_mAddButton_clicked()
{ {
newComposer->close(); newComposer->close();
QgisApp::instance()->deleteComposer( newComposer ); QgisApp::instance()->deleteComposer( newComposer );
newComposer = 0; newComposer = nullptr;
QMessageBox::warning( this, tr( "Template error" ), tr( "Error, could not load template file" ) ); QMessageBox::warning( this, tr( "Template error" ), tr( "Error, could not load template file" ) );
} }
} }
@ -435,7 +435,7 @@ void QgsComposerManager::show_clicked()
QMap<QListWidgetItem*, QgsComposer*>::const_iterator it = mItemComposerMap.find( item ); QMap<QListWidgetItem*, QgsComposer*>::const_iterator it = mItemComposerMap.find( item );
if ( it != mItemComposerMap.constEnd() ) if ( it != mItemComposerMap.constEnd() )
{ {
QgsComposer* c = 0; QgsComposer* c = nullptr;
if ( it.value() ) //a normal composer if ( it.value() ) //a normal composer
{ {
c = it.value(); c = it.value();
@ -464,7 +464,7 @@ void QgsComposerManager::duplicate_clicked()
return; return;
} }
QgsComposer* currentComposer = 0; QgsComposer* currentComposer = nullptr;
QString currentTitle; QString currentTitle;
QListWidgetItem* item = mComposerListWidget->selectedItems().at( 0 ); QListWidgetItem* item = mComposerListWidget->selectedItems().at( 0 );
@ -494,7 +494,7 @@ void QgsComposerManager::duplicate_clicked()
dlg->close(); dlg->close();
delete dlg; delete dlg;
dlg = 0; dlg = nullptr;
if ( newComposer ) if ( newComposer )
{ {
@ -516,7 +516,7 @@ void QgsComposerManager::rename_clicked()
} }
QString currentTitle; QString currentTitle;
QgsComposer* currentComposer = 0; QgsComposer* currentComposer = nullptr;
QListWidgetItem* item = mComposerListWidget->selectedItems().at( 0 ); QListWidgetItem* item = mComposerListWidget->selectedItems().at( 0 );
QMap<QListWidgetItem*, QgsComposer*>::iterator it = mItemComposerMap.find( item ); QMap<QListWidgetItem*, QgsComposer*>::iterator it = mItemComposerMap.find( item );
@ -596,7 +596,7 @@ void QgsComposerNameDelegate::setModelData( QWidget *editor, QAbstractItemModel
if ( changed && cNames.contains( value ) ) if ( changed && cNames.contains( value ) )
{ {
//name exists! //name exists!
QMessageBox::warning( 0, tr( "Rename composer" ), tr( "There is already a composer named \"%1\"" ).arg( value ) ); QMessageBox::warning( nullptr, tr( "Rename composer" ), tr( "There is already a composer named \"%1\"" ).arg( value ) );
return; return;
} }

View File

@ -30,7 +30,7 @@ class QgsComposerNameDelegate : public QItemDelegate
Q_OBJECT Q_OBJECT
public: public:
explicit QgsComposerNameDelegate( QObject *parent = 0 ); explicit QgsComposerNameDelegate( QObject *parent = nullptr );
QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index ) const override; const QModelIndex &index ) const override;
@ -49,7 +49,7 @@ class QgsComposerManager: public QDialog, private Ui::QgsComposerManagerBase
{ {
Q_OBJECT Q_OBJECT
public: public:
QgsComposerManager( QWidget * parent = 0, Qt::WindowFlags f = 0 ); QgsComposerManager( QWidget * parent = nullptr, Qt::WindowFlags f = nullptr );
~QgsComposerManager(); ~QgsComposerManager();
void addTemplates( const QMap<QString, QString>& templates ); void addTemplates( const QMap<QString, QString>& templates );

View File

@ -44,7 +44,7 @@
#include <QMessageBox> #include <QMessageBox>
QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ) QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap )
: QgsComposerItemBaseWidget( 0, composerMap ) : QgsComposerItemBaseWidget( nullptr, composerMap )
, mComposerMap( composerMap ) , mComposerMap( composerMap )
{ {
setupUi( this ); setupUi( this );
@ -1194,7 +1194,7 @@ void QgsComposerMapWidget::on_mAddGridPushButton_clicked()
addGridListItem( grid->id(), grid->name() ); addGridListItem( grid->id(), grid->name() );
mGridListWidget->setCurrentRow( 0 ); mGridListWidget->setCurrentRow( 0 );
on_mGridListWidget_currentItemChanged( mGridListWidget->currentItem(), 0 ); on_mGridListWidget_currentItemChanged( mGridListWidget->currentItem(), nullptr );
} }
void QgsComposerMapWidget::on_mRemoveGridPushButton_clicked() void QgsComposerMapWidget::on_mRemoveGridPushButton_clicked()
@ -1256,13 +1256,13 @@ QgsComposerMapGrid* QgsComposerMapWidget::currentGrid()
{ {
if ( !mComposerMap ) if ( !mComposerMap )
{ {
return 0; return nullptr;
} }
QListWidgetItem* item = mGridListWidget->currentItem(); QListWidgetItem* item = mGridListWidget->currentItem();
if ( !item ) if ( !item )
{ {
return 0; return nullptr;
} }
return mComposerMap->grids()->grid( item->data( Qt::UserRole ).toString() ); return mComposerMap->grids()->grid( item->data( Qt::UserRole ).toString() );
@ -1566,7 +1566,7 @@ void QgsComposerMapWidget::on_mGridLineStyleButton_clicked()
} }
QgsLineSymbolV2* newSymbol = static_cast<QgsLineSymbolV2*>( grid->lineSymbol()->clone() ); QgsLineSymbolV2* newSymbol = static_cast<QgsLineSymbolV2*>( grid->lineSymbol()->clone() );
QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), 0, this ); QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), nullptr, this );
if ( d.exec() == QDialog::Accepted ) if ( d.exec() == QDialog::Accepted )
{ {
@ -1591,7 +1591,7 @@ void QgsComposerMapWidget::on_mGridMarkerStyleButton_clicked()
} }
QgsMarkerSymbolV2* newSymbol = static_cast<QgsMarkerSymbolV2*>( grid->markerSymbol()->clone() ); QgsMarkerSymbolV2* newSymbol = static_cast<QgsMarkerSymbolV2*>( grid->markerSymbol()->clone() );
QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), 0, this ); QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), nullptr, this );
if ( d.exec() == QDialog::Accepted ) if ( d.exec() == QDialog::Accepted )
{ {
@ -2029,7 +2029,7 @@ void QgsComposerMapWidget::on_mAnnotationFormatButton_clicked()
QScopedPointer< QgsExpressionContext> expressionContext( grid->createExpressionContext() ); QScopedPointer< QgsExpressionContext> expressionContext( grid->createExpressionContext() );
QgsExpressionBuilderDialog exprDlg( 0, grid->annotationExpression(), this, "generic", *expressionContext ); QgsExpressionBuilderDialog exprDlg( nullptr, grid->annotationExpression(), this, "generic", *expressionContext );
exprDlg.setWindowTitle( tr( "Expression based annotation" ) ); exprDlg.setWindowTitle( tr( "Expression based annotation" ) );
if ( exprDlg.exec() == QDialog::Accepted ) if ( exprDlg.exec() == QDialog::Accepted )
@ -2186,7 +2186,7 @@ void QgsComposerMapWidget::on_mCoordinatePrecisionSpinBox_valueChanged( int valu
QListWidgetItem* QgsComposerMapWidget::addGridListItem( const QString& id, const QString& name ) QListWidgetItem* QgsComposerMapWidget::addGridListItem( const QString& id, const QString& name )
{ {
QListWidgetItem* item = new QListWidgetItem( name, 0 ); QListWidgetItem* item = new QListWidgetItem( name, nullptr );
item->setData( Qt::UserRole, id ); item->setData( Qt::UserRole, id );
item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable ); item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable );
mGridListWidget->insertItem( 0, item ); mGridListWidget->insertItem( 0, item );
@ -2225,11 +2225,11 @@ void QgsComposerMapWidget::loadGridEntries()
if ( mGridListWidget->currentItem() ) if ( mGridListWidget->currentItem() )
{ {
on_mGridListWidget_currentItemChanged( mGridListWidget->currentItem(), 0 ); on_mGridListWidget_currentItemChanged( mGridListWidget->currentItem(), nullptr );
} }
else else
{ {
on_mGridListWidget_currentItemChanged( 0, 0 ); on_mGridListWidget_currentItemChanged( nullptr, nullptr );
} }
} }
@ -2331,13 +2331,13 @@ QgsComposerMapOverview* QgsComposerMapWidget::currentOverview()
{ {
if ( !mComposerMap ) if ( !mComposerMap )
{ {
return 0; return nullptr;
} }
QListWidgetItem* item = mOverviewListWidget->currentItem(); QListWidgetItem* item = mOverviewListWidget->currentItem();
if ( !item ) if ( !item )
{ {
return 0; return nullptr;
} }
return mComposerMap->overviews()->overview( item->data( Qt::UserRole ).toString() ); return mComposerMap->overviews()->overview( item->data( Qt::UserRole ).toString() );
@ -2440,7 +2440,7 @@ void QgsComposerMapWidget::updateOverviewFrameSymbolMarker( const QgsComposerMap
QListWidgetItem* QgsComposerMapWidget::addOverviewListItem( const QString& id, const QString& name ) QListWidgetItem* QgsComposerMapWidget::addOverviewListItem( const QString& id, const QString& name )
{ {
QListWidgetItem* item = new QListWidgetItem( name, 0 ); QListWidgetItem* item = new QListWidgetItem( name, nullptr );
item->setData( Qt::UserRole, id ); item->setData( Qt::UserRole, id );
item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable ); item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable );
mOverviewListWidget->insertItem( 0, item ); mOverviewListWidget->insertItem( 0, item );
@ -2479,11 +2479,11 @@ void QgsComposerMapWidget::loadOverviewEntries()
if ( mOverviewListWidget->currentItem() ) if ( mOverviewListWidget->currentItem() )
{ {
on_mOverviewListWidget_currentItemChanged( mOverviewListWidget->currentItem(), 0 ); on_mOverviewListWidget_currentItemChanged( mOverviewListWidget->currentItem(), nullptr );
} }
else else
{ {
on_mOverviewListWidget_currentItemChanged( 0, 0 ); on_mOverviewListWidget_currentItemChanged( nullptr, nullptr );
} }
} }
@ -2570,7 +2570,7 @@ void QgsComposerMapWidget::on_mOverviewFrameStyleButton_clicked()
} }
QgsFillSymbolV2* newSymbol = static_cast<QgsFillSymbolV2*>( overview->frameSymbol()->clone() ); QgsFillSymbolV2* newSymbol = static_cast<QgsFillSymbolV2*>( overview->frameSymbol()->clone() );
QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), 0, this ); QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), nullptr, this );
if ( d.exec() == QDialog::Accepted ) if ( d.exec() == QDialog::Accepted )
{ {

View File

@ -32,7 +32,7 @@
#include <QSettings> #include <QSettings>
#include <QSvgRenderer> #include <QSvgRenderer>
QgsComposerPictureWidget::QgsComposerPictureWidget( QgsComposerPicture* picture ): QgsComposerItemBaseWidget( 0, picture ), mPicture( picture ), mPreviewsLoaded( false ) QgsComposerPictureWidget::QgsComposerPictureWidget( QgsComposerPicture* picture ): QgsComposerItemBaseWidget( nullptr, picture ), mPicture( picture ), mPreviewsLoaded( false )
{ {
setupUi( this ); setupUi( this );
@ -100,7 +100,7 @@ void QgsComposerPictureWidget::on_mPictureBrowseButton_clicked()
QFileInfo fileInfo( filePath ); QFileInfo fileInfo( filePath );
if ( !fileInfo.exists() || !fileInfo.isReadable() ) if ( !fileInfo.exists() || !fileInfo.isReadable() )
{ {
QMessageBox::critical( 0, "Invalid file", "Error, file does not exist or is not readable" ); QMessageBox::critical( nullptr, "Invalid file", "Error, file does not exist or is not readable" );
return; return;
} }

View File

@ -23,7 +23,7 @@
#include <QFontDialog> #include <QFontDialog>
#include <QWidget> #include <QWidget>
QgsComposerScaleBarWidget::QgsComposerScaleBarWidget( QgsComposerScaleBar* scaleBar ): QgsComposerItemBaseWidget( 0, scaleBar ), mComposerScaleBar( scaleBar ) QgsComposerScaleBarWidget::QgsComposerScaleBarWidget( QgsComposerScaleBar* scaleBar ): QgsComposerItemBaseWidget( nullptr, scaleBar ), mComposerScaleBar( scaleBar )
{ {
setupUi( this ); setupUi( this );
connectUpdateSignal(); connectUpdateSignal();

View File

@ -24,7 +24,7 @@
#include "qgssymbollayerv2utils.h" #include "qgssymbollayerv2utils.h"
#include <QColorDialog> #include <QColorDialog>
QgsComposerShapeWidget::QgsComposerShapeWidget( QgsComposerShape* composerShape ): QgsComposerItemBaseWidget( 0, composerShape ), mComposerShape( composerShape ) QgsComposerShapeWidget::QgsComposerShapeWidget( QgsComposerShape* composerShape ): QgsComposerItemBaseWidget( nullptr, composerShape ), mComposerShape( composerShape )
{ {
setupUi( this ); setupUi( this );

View File

@ -38,7 +38,7 @@ class QgsComposerTableBackgroundColorsDialog: public QDialog, private Ui::QgsCom
* @param parent parent widget * @param parent parent widget
* @param flags window flags * @param flags window flags
*/ */
QgsComposerTableBackgroundColorsDialog( QgsComposerTableV2* table, QWidget* parent = 0, Qt::WindowFlags flags = 0 ); QgsComposerTableBackgroundColorsDialog( QgsComposerTableV2* table, QWidget* parent = nullptr, Qt::WindowFlags flags = nullptr );
~QgsComposerTableBackgroundColorsDialog(); ~QgsComposerTableBackgroundColorsDialog();

View File

@ -26,7 +26,7 @@
#include "qgsexpressionbuilderdialog.h" #include "qgsexpressionbuilderdialog.h"
#include "qgisgui.h" #include "qgisgui.h"
QgsComposerTableWidget::QgsComposerTableWidget( QgsComposerAttributeTable* table ): QgsComposerItemBaseWidget( 0, table ), mComposerTable( table ) QgsComposerTableWidget::QgsComposerTableWidget( QgsComposerAttributeTable* table ): QgsComposerItemBaseWidget( nullptr, table ), mComposerTable( table )
{ {
setupUi( this ); setupUi( this );
//add widget for general composer item properties //add widget for general composer item properties

View File

@ -142,7 +142,7 @@ QgsCompositionWidget::QgsCompositionWidget( QWidget* parent, QgsComposition* c )
blockSignals( false ); blockSignals( false );
} }
QgsCompositionWidget::QgsCompositionWidget(): QWidget( 0 ), mComposition( 0 ) QgsCompositionWidget::QgsCompositionWidget(): QWidget( nullptr ), mComposition( nullptr )
{ {
setupUi( this ); setupUi( this );
} }
@ -171,7 +171,7 @@ void QgsCompositionWidget::populateDataDefinedButtons()
return; return;
} }
QgsVectorLayer* vl = 0; QgsVectorLayer* vl = nullptr;
QgsAtlasComposition* atlas = &mComposition->atlasComposition(); QgsAtlasComposition* atlas = &mComposition->atlasComposition();
if ( atlas && atlas->enabled() ) if ( atlas && atlas->enabled() )
@ -570,7 +570,7 @@ void QgsCompositionWidget::on_mPageStyleButton_clicked()
return; return;
} }
QgsVectorLayer* coverageLayer = 0; QgsVectorLayer* coverageLayer = nullptr;
// use the atlas coverage layer, if any // use the atlas coverage layer, if any
if ( mComposition->atlasComposition().enabled() ) if ( mComposition->atlasComposition().enabled() )
{ {
@ -704,7 +704,7 @@ void QgsCompositionWidget::onItemRemoved( QgsComposerItem* item )
} }
if ( mWorldFileMapComboBox->count() == 0 ) if ( mWorldFileMapComboBox->count() == 0 )
{ {
mComposition->setWorldFileMap( 0 ); mComposition->setWorldFileMap( nullptr );
} }
} }
@ -716,7 +716,7 @@ void QgsCompositionWidget::on_mWorldFileMapComboBox_currentIndexChanged( int ind
} }
if ( index == -1 ) if ( index == -1 )
{ {
mComposition->setWorldFileMap( 0 ); mComposition->setWorldFileMap( nullptr );
} }
else else
{ {

View File

@ -66,17 +66,17 @@
QgsGPSInformationWidget::QgsGPSInformationWidget( QgsMapCanvas * thepCanvas, QWidget * parent, Qt::WindowFlags f ) QgsGPSInformationWidget::QgsGPSInformationWidget( QgsMapCanvas * thepCanvas, QWidget * parent, Qt::WindowFlags f )
: QWidget( parent, f ) : QWidget( parent, f )
, mNmea( 0 ) , mNmea( nullptr )
, mpCanvas( thepCanvas ) , mpCanvas( thepCanvas )
{ {
setupUi( this ); setupUi( this );
mpLastLayer = 0; mpLastLayer = nullptr;
mLastGpsPosition = QgsPoint( 0.0, 0.0 ); mLastGpsPosition = QgsPoint( 0.0, 0.0 );
mpMapMarker = 0; mpMapMarker = nullptr;
mpRubberBand = 0; mpRubberBand = nullptr;
populateDevices(); populateDevices();
QWidget * mpHistogramWidget = mStackedWidget->widget( 1 ); QWidget * mpHistogramWidget = mStackedWidget->widget( 1 );
#if (!WITH_QWTPOLAR) #if (!WITH_QWTPOLAR)
@ -237,7 +237,7 @@ QgsGPSInformationWidget::QgsGPSInformationWidget( QgsMapCanvas * thepCanvas, QWi
setStatusIndicator( NoData ); setStatusIndicator( NoData );
//SLM - added functionality //SLM - added functionality
mLogFile = 0; mLogFile = nullptr;
connect( QgisApp::instance()->layerTreeView(), SIGNAL( currentLayerChanged( QgsMapLayer* ) ), connect( QgisApp::instance()->layerTreeView(), SIGNAL( currentLayerChanged( QgsMapLayer* ) ),
this, SLOT( updateCloseFeatureButton( QgsMapLayer* ) ) ); this, SLOT( updateCloseFeatureButton( QgsMapLayer* ) ) );
@ -429,7 +429,7 @@ void QgsGPSInformationWidget::connectGps()
void QgsGPSInformationWidget::timedout() void QgsGPSInformationWidget::timedout()
{ {
mConnectButton->setChecked( false ); mConnectButton->setChecked( false );
mNmea = NULL; mNmea = nullptr;
mGPSPlainTextEdit->appendPlainText( tr( "Timed out!" ) ); mGPSPlainTextEdit->appendPlainText( tr( "Timed out!" ) );
showStatusBarMessage( tr( "Failed to connect to GPS device." ) ); showStatusBarMessage( tr( "Failed to connect to GPS device." ) );
} }
@ -464,7 +464,7 @@ void QgsGPSInformationWidget::connected( QgsGPSConnection *conn )
else // error opening file else // error opening file
{ {
delete mLogFile; delete mLogFile;
mLogFile = 0; mLogFile = nullptr;
// need to indicate why - this just reports that an error occurred // need to indicate why - this just reports that an error occurred
showStatusBarMessage( tr( "Error opening log file." ) ); showStatusBarMessage( tr( "Error opening log file." ) );
@ -479,16 +479,16 @@ void QgsGPSInformationWidget::disconnectGps()
disconnect( mNmea, SIGNAL( nmeaSentenceReceived( const QString& ) ), this, SLOT( logNmeaSentence( const QString& ) ) ); disconnect( mNmea, SIGNAL( nmeaSentenceReceived( const QString& ) ), this, SLOT( logNmeaSentence( const QString& ) ) );
mLogFile->close(); mLogFile->close();
delete mLogFile; delete mLogFile;
mLogFile = 0; mLogFile = nullptr;
} }
QgsGPSConnectionRegistry::instance()->unregisterConnection( mNmea ); QgsGPSConnectionRegistry::instance()->unregisterConnection( mNmea );
delete mNmea; delete mNmea;
mNmea = NULL; mNmea = nullptr;
if ( mpMapMarker ) // marker should not be shown on GPS disconnected - not current position if ( mpMapMarker ) // marker should not be shown on GPS disconnected - not current position
{ {
delete mpMapMarker; delete mpMapMarker;
mpMapMarker = NULL; mpMapMarker = nullptr;
} }
mGPSPlainTextEdit->appendPlainText( tr( "Disconnected..." ) ); mGPSPlainTextEdit->appendPlainText( tr( "Disconnected..." ) );
mConnectButton->setChecked( false ); mConnectButton->setChecked( false );
@ -736,7 +736,7 @@ void QgsGPSInformationWidget::displayGPSInformation( const QgsGPSInformation& in
if ( mpMapMarker ) if ( mpMapMarker )
{ {
delete mpMapMarker; delete mpMapMarker;
mpMapMarker = 0; mpMapMarker = nullptr;
} }
} // show marker } // show marker
} }
@ -795,7 +795,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked()
//lines: bail out if there are not at least two vertices //lines: bail out if there are not at least two vertices
if ( layerWKBType == QGis::WKBLineString && mCaptureList.size() < 2 ) if ( layerWKBType == QGis::WKBLineString && mCaptureList.size() < 2 )
{ {
QMessageBox::information( 0, tr( "Not enough vertices" ), QMessageBox::information( nullptr, tr( "Not enough vertices" ),
tr( "Cannot close a line feature until it has at least two vertices." ) ); tr( "Cannot close a line feature until it has at least two vertices." ) );
return; return;
} }
@ -803,7 +803,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked()
//polygons: bail out if there are not at least three vertices //polygons: bail out if there are not at least three vertices
if ( layerWKBType == QGis::WKBPolygon && mCaptureList.size() < 3 ) if ( layerWKBType == QGis::WKBPolygon && mCaptureList.size() < 3 )
{ {
QMessageBox::information( 0, tr( "Not enough vertices" ), QMessageBox::information( nullptr, tr( "Not enough vertices" ),
tr( "Cannot close a polygon feature until it has at least three vertices." ) ); tr( "Cannot close a polygon feature until it has at least three vertices." ) );
return; return;
} }
@ -818,7 +818,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked()
int size = 0; int size = 0;
char end = QgsApplication::endian(); char end = QgsApplication::endian();
unsigned char *wkb = NULL; unsigned char *wkb = nullptr;
int wkbtype = 0; int wkbtype = 0;
QgsCoordinateTransform t( mWgs84CRS, vlayer->crs() ); QgsCoordinateTransform t( mWgs84CRS, vlayer->crs() );
@ -952,14 +952,14 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked()
else if ( avoidIntersectionsReturn == 2 ) else if ( avoidIntersectionsReturn == 2 )
{ {
//bail out... //bail out...
QMessageBox::critical( 0, tr( "Error" ), tr( "The feature could not be added because removing the polygon intersections would change the geometry type" ) ); QMessageBox::critical( nullptr, tr( "Error" ), tr( "The feature could not be added because removing the polygon intersections would change the geometry type" ) );
delete f; delete f;
connectGpsSlot(); connectGpsSlot();
return; return;
} }
else if ( avoidIntersectionsReturn == 3 ) else if ( avoidIntersectionsReturn == 3 )
{ {
QMessageBox::critical( 0, tr( "Error" ), tr( "An error was reported during intersection removal" ) ); QMessageBox::critical( nullptr, tr( "Error" ), tr( "An error was reported during intersection removal" ) );
delete f; delete f;
connectGpsSlot(); connectGpsSlot();
return; return;
@ -968,7 +968,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked()
// Should never get here, as preconditions should have removed any that aren't handled // Should never get here, as preconditions should have removed any that aren't handled
else // layerWKBType == QGis::WKBPolygon - unknown type else // layerWKBType == QGis::WKBPolygon - unknown type
{ {
QMessageBox::critical( 0, tr( "Error" ), tr( "Cannot add feature. " QMessageBox::critical( nullptr, tr( "Error" ), tr( "Cannot add feature. "
"Unknown WKB type. Choose a different layer and try again." ) ); "Unknown WKB type. Choose a different layer and try again." ) );
connectGpsSlot(); connectGpsSlot();
delete f; delete f;
@ -992,7 +992,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked()
vlayer->startEditing(); vlayer->startEditing();
} }
delete mpRubberBand; delete mpRubberBand;
mpRubberBand = NULL; mpRubberBand = nullptr;
// delete the elements of mCaptureList // delete the elements of mCaptureList
mCaptureList.clear(); mCaptureList.clear();

View File

@ -44,7 +44,7 @@ class QgsGPSInformationWidget: public QWidget, private Ui::QgsGPSInformationWidg
{ {
Q_OBJECT Q_OBJECT
public: public:
QgsGPSInformationWidget( QgsMapCanvas * thepCanvas, QWidget * parent = 0, Qt::WindowFlags f = 0 ); QgsGPSInformationWidget( QgsMapCanvas * thepCanvas, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr );
~QgsGPSInformationWidget(); ~QgsGPSInformationWidget();
private slots: private slots:

View File

@ -122,7 +122,7 @@ static QgsLayerTreeGroup* _groupIndexToNode( int groupIndex, QgsLayerTreeGroup*
} }
} }
return 0; return nullptr;
} }
QgsLayerTreeGroup* QgsAppLegendInterface::groupIndexToNode( int itemIndex ) QgsLayerTreeGroup* QgsAppLegendInterface::groupIndexToNode( int itemIndex )
@ -237,7 +237,7 @@ QList< GroupLayerInfo > QgsAppLegendInterface::groupLayerRelationship()
bool QgsAppLegendInterface::groupExists( int groupIndex ) bool QgsAppLegendInterface::groupExists( int groupIndex )
{ {
return groupIndexToNode( groupIndex ) != 0; return groupIndexToNode( groupIndex ) != nullptr;
} }
bool QgsAppLegendInterface::isGroupExpanded( int groupIndex ) bool QgsAppLegendInterface::isGroupExpanded( int groupIndex )

View File

@ -81,7 +81,7 @@ class QgsAppLegendInterface : public QgsLegendInterface
public slots: public slots:
//! Add a new group //! Add a new group
int addGroup( const QString& name, bool expand = true, QTreeWidgetItem* parent = 0 ) override; int addGroup( const QString& name, bool expand = true, QTreeWidgetItem* parent = nullptr ) override;
//! Add a new group at a specified index //! Add a new group at a specified index
int addGroup( const QString& name, bool expand, int groupIndex ) override; int addGroup( const QString& name, bool expand, int groupIndex ) override;

View File

@ -211,7 +211,7 @@ static void dumpBacktrace( unsigned int depth )
} }
close( fd[1] ); // close writing end close( fd[1] ); // close writing end
execl( "/usr/bin/c++filt", "c++filt", ( char * ) 0 ); execl( "/usr/bin/c++filt", "c++filt", ( char * ) nullptr );
perror( "could not start c++filt" ); perror( "could not start c++filt" );
exit( 1 ); exit( 1 );
} }
@ -456,7 +456,7 @@ int main( int argc, char *argv[] )
#endif #endif
// initialize random number seed // initialize random number seed
qsrand( time( NULL ) ); qsrand( time( nullptr ) );
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Command line options 'behaviour' flag setup // Command line options 'behaviour' flag setup
@ -720,7 +720,7 @@ int main( int argc, char *argv[] )
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(ANDROID) #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(ANDROID)
bool myUseGuiFlag = getenv( "DISPLAY" ) != 0; bool myUseGuiFlag = getenv( "DISPLAY" ) != nullptr;
#else #else
bool myUseGuiFlag = true; bool myUseGuiFlag = true;
#endif #endif
@ -934,8 +934,8 @@ int main( int argc, char *argv[] )
} }
} }
QTranslator qgistor( 0 ); QTranslator qgistor( nullptr );
QTranslator qttor( 0 ); QTranslator qttor( nullptr );
if ( myTranslationCode != "C" ) if ( myTranslationCode != "C" )
{ {
if ( qgistor.load( QString( "qgis_" ) + myTranslationCode, i18nPath ) ) if ( qgistor.load( QString( "qgis_" ) + myTranslationCode, i18nPath ) )

View File

@ -33,14 +33,14 @@
QgsMapToolNodeTool::QgsMapToolNodeTool( QgsMapCanvas* canvas ) QgsMapToolNodeTool::QgsMapToolNodeTool( QgsMapCanvas* canvas )
: QgsMapToolEdit( canvas ) : QgsMapToolEdit( canvas )
, mSelectRubberBand( 0 ) , mSelectRubberBand( nullptr )
, mSelectedFeature( 0 ) , mSelectedFeature( nullptr )
, mNodeEditor( 0 ) , mNodeEditor( nullptr )
, mMoving( true ) , mMoving( true )
, mSelectAnother( false ) , mSelectAnother( false )
, mAnother( 0 ) , mAnother( 0 )
, mSelectionRubberBand( 0 ) , mSelectionRubberBand( nullptr )
, mRect( 0 ) , mRect( nullptr )
, mIsPoint( false ) , mIsPoint( false )
, mDeselectOnRelease( -1 ) , mDeselectOnRelease( -1 )
{ {
@ -403,9 +403,9 @@ void QgsMapToolNodeTool::canvasReleaseEvent( QgsMapMouseEvent* e )
if ( mRect ) if ( mRect )
{ {
delete mSelectionRubberBand; delete mSelectionRubberBand;
mSelectionRubberBand = 0; mSelectionRubberBand = nullptr;
delete mRect; delete mRect;
mRect = 0; mRect = nullptr;
} }
if ( mPressCoordinates == e->pos() ) if ( mPressCoordinates == e->pos() )
@ -495,7 +495,7 @@ void QgsMapToolNodeTool::deactivate()
{ {
cleanTool(); cleanTool();
mSelectionRubberBand = 0; mSelectionRubberBand = nullptr;
mSelectAnother = false; mSelectAnother = false;
mMoving = true; mMoving = true;
@ -516,7 +516,7 @@ void QgsMapToolNodeTool::cleanTool( bool deleteSelectedFeature )
if ( mSelectRubberBand ) if ( mSelectRubberBand )
{ {
delete mSelectRubberBand; delete mSelectRubberBand;
mSelectRubberBand = 0; mSelectRubberBand = nullptr;
} }
if ( mSelectedFeature ) if ( mSelectedFeature )
@ -531,13 +531,13 @@ void QgsMapToolNodeTool::cleanTool( bool deleteSelectedFeature )
if ( deleteSelectedFeature ) if ( deleteSelectedFeature )
delete mSelectedFeature; delete mSelectedFeature;
mSelectedFeature = 0; mSelectedFeature = nullptr;
} }
if ( mNodeEditor ) if ( mNodeEditor )
{ {
delete mNodeEditor; delete mNodeEditor;
mNodeEditor = 0; mNodeEditor = nullptr;
} }
} }

View File

@ -37,7 +37,7 @@ class QgsNodeEditorModel : public QAbstractTableModel
QgsNodeEditorModel( QgsVectorLayer* layer, QgsNodeEditorModel( QgsVectorLayer* layer,
QgsSelectedFeature* selectedFeature, QgsSelectedFeature* selectedFeature,
QgsMapCanvas* canvas, QObject* parent = 0 ); QgsMapCanvas* canvas, QObject* parent = nullptr );
virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const override; virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
int columnCount( const QModelIndex &parent = QModelIndex() ) const override; int columnCount( const QModelIndex &parent = QModelIndex() ) const override;

View File

@ -31,9 +31,9 @@ QgsSelectedFeature::QgsSelectedFeature( QgsFeatureId featureId,
QgsVectorLayer *vlayer, QgsVectorLayer *vlayer,
QgsMapCanvas *canvas ) QgsMapCanvas *canvas )
: mFeatureId( featureId ) : mFeatureId( featureId )
, mGeometry( 0 ) , mGeometry( nullptr )
, mChangingGeometry( false ) , mChangingGeometry( false )
, mValidator( 0 ) , mValidator( nullptr )
{ {
QgsDebugCall; QgsDebugCall;
setSelectedFeature( featureId, vlayer, canvas ); setSelectedFeature( featureId, vlayer, canvas );
@ -55,7 +55,7 @@ QgsSelectedFeature::~QgsSelectedFeature()
mValidator->stop(); mValidator->stop();
mValidator->wait(); mValidator->wait();
mValidator->deleteLater(); mValidator->deleteLater();
mValidator = 0; mValidator = nullptr;
} }
delete mGeometry; delete mGeometry;
@ -93,7 +93,7 @@ void QgsSelectedFeature::setSelectedFeature( QgsFeatureId featureId, QgsVectorLa
mCanvas = canvas; mCanvas = canvas;
delete mGeometry; delete mGeometry;
mGeometry = 0; mGeometry = nullptr;
// signal changing of current layer // signal changing of current layer
connect( QgisApp::instance()->layerTreeView(), SIGNAL( currentLayerChanged( QgsMapLayer* ) ), this, SLOT( currentLayerChanged( QgsMapLayer* ) ) ); connect( QgisApp::instance()->layerTreeView(), SIGNAL( currentLayerChanged( QgsMapLayer* ) ), this, SLOT( currentLayerChanged( QgsMapLayer* ) ) );
@ -177,7 +177,7 @@ void QgsSelectedFeature::validateGeometry( QgsGeometry *g )
mValidator->stop(); mValidator->stop();
mValidator->wait(); mValidator->wait();
mValidator->deleteLater(); mValidator->deleteLater();
mValidator = 0; mValidator = nullptr;
} }
mGeomErrors.clear(); mGeomErrors.clear();
@ -319,7 +319,7 @@ void QgsSelectedFeature::moveSelectedVertexes( const QgsVector &v )
QMultiMap<double, QgsSnappingResult> currentResultList; QMultiMap<double, QgsSnappingResult> currentResultList;
for ( int i = mVertexMap.size() - 1; i > -1 && nUpdates > 0; i-- ) for ( int i = mVertexMap.size() - 1; i > -1 && nUpdates > 0; i-- )
{ {
QgsVertexEntry *entry = mVertexMap.value( i, 0 ); QgsVertexEntry *entry = mVertexMap.value( i, nullptr );
if ( !entry || !entry->isSelected() ) if ( !entry || !entry->isSelected() )
continue; continue;
@ -400,7 +400,7 @@ void QgsSelectedFeature::createVertexMap()
if ( !mGeometry ) if ( !mGeometry )
{ {
QgsDebugMsg( "Loading feature" ); QgsDebugMsg( "Loading feature" );
updateGeometry( 0 ); updateGeometry( nullptr );
} }
if ( !mGeometry ) if ( !mGeometry )

View File

@ -194,7 +194,7 @@ class QgsSelectedFeature: public QObject
/** /**
* Validates the geometry * Validates the geometry
*/ */
void validateGeometry( QgsGeometry *g = 0 ); void validateGeometry( QgsGeometry *g = nullptr );
QgsFeatureId mFeatureId; QgsFeatureId mFeatureId;
QgsGeometry *mGeometry; QgsGeometry *mGeometry;

View File

@ -23,7 +23,7 @@ QgsVertexEntry::QgsVertexEntry( QgsMapCanvas *canvas, QgsMapLayer *layer, const
, mPenWidth( penWidth ) , mPenWidth( penWidth )
, mToolTip( tooltip ) , mToolTip( tooltip )
, mType( type ) , mType( type )
, mMarker( 0 ) , mMarker( nullptr )
, mCanvas( canvas ) , mCanvas( canvas )
, mLayer( layer ) , mLayer( layer )
{ {
@ -64,7 +64,7 @@ void QgsVertexEntry::placeMarker()
else if ( mMarker ) else if ( mMarker )
{ {
delete mMarker; delete mMarker;
mMarker = 0; mMarker = nullptr;
} }
} }

View File

@ -89,7 +89,7 @@ void QgsNewOgrConnection::testConnection()
OGRSFDriverH pahDriver; OGRSFDriverH pahDriver;
CPLErrorReset(); CPLErrorReset();
poDS = OGROpen( TO8F( uri ), false, &pahDriver ); poDS = OGROpen( TO8F( uri ), false, &pahDriver );
if ( poDS == NULL ) if ( poDS == nullptr )
{ {
QMessageBox::information( this, tr( "Test connection" ), tr( "Connection failed - Check settings and try again.\n\nExtended error information:\n%1" ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) ); QMessageBox::information( this, tr( "Test connection" ), tr( "Connection failed - Check settings and try again.\n\nExtended error information:\n%1" ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
} }

View File

@ -31,7 +31,7 @@ class QgsNewOgrConnection : public QDialog, private Ui::QgsNewOgrConnectionBase
public: public:
//! Constructor //! Constructor
QgsNewOgrConnection( QWidget *parent = 0, const QString& connType = QString::null, const QString& connName = QString::null, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); QgsNewOgrConnection( QWidget *parent = nullptr, const QString& connType = QString::null, const QString& connName = QString::null, Qt::WindowFlags fl = QgisGui::ModalDialogFlags );
//! Destructor //! Destructor
~QgsNewOgrConnection(); ~QgsNewOgrConnection();
//! Tests the connection using the parameters supplied //! Tests the connection using the parameters supplied

View File

@ -32,7 +32,7 @@ class QgsOpenVectorLayerDialog : public QDialog, private Ui::QgsOpenVectorLayerD
Q_OBJECT Q_OBJECT
public: public:
QgsOpenVectorLayerDialog( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); QgsOpenVectorLayerDialog( QWidget* parent = nullptr, Qt::WindowFlags fl = nullptr );
~QgsOpenVectorLayerDialog(); ~QgsOpenVectorLayerDialog();
//! Opens a dialog to select a file datasource*/ //! Opens a dialog to select a file datasource*/
QStringList openFile(); QStringList openFile();

View File

@ -119,7 +119,7 @@ QList<QPair<QLabel*, QWidget*> > QgsVectorLayerSaveAsDialog::createControls( con
{ {
QgsVectorFileWriter::Option *option = it.value(); QgsVectorFileWriter::Option *option = it.value();
QLabel *label = new QLabel( it.key() ); QLabel *label = new QLabel( it.key() );
QWidget *control = 0; QWidget *control = nullptr;
switch ( option->type ) switch ( option->type )
{ {
case QgsVectorFileWriter::Int: case QgsVectorFileWriter::Int:
@ -170,7 +170,7 @@ QList<QPair<QLabel*, QWidget*> > QgsVectorLayerSaveAsDialog::createControls( con
} }
case QgsVectorFileWriter::Hidden: case QgsVectorFileWriter::Hidden:
control = 0; control = nullptr;
break; break;
} }
@ -293,7 +293,7 @@ void QgsVectorLayerSaveAsDialog::on_browseFilename_clicked()
QSettings settings; QSettings settings;
QString dirName = leFilename->text().isEmpty() ? settings.value( "/UI/lastVectorFileFilterDir", QDir::homePath() ).toString() : leFilename->text(); QString dirName = leFilename->text().isEmpty() ? settings.value( "/UI/lastVectorFileFilterDir", QDir::homePath() ).toString() : leFilename->text();
QString filterString = QgsVectorFileWriter::filterForDriver( format() ); QString filterString = QgsVectorFileWriter::filterForDriver( format() );
QString outputFile = QFileDialog::getSaveFileName( 0, tr( "Save layer as..." ), dirName, filterString ); QString outputFile = QFileDialog::getSaveFileName( nullptr, tr( "Save layer as..." ), dirName, filterString );
if ( !outputFile.isNull() ) if ( !outputFile.isNull() )
{ {
leFilename->setText( outputFile ); leFilename->setText( outputFile );

View File

@ -38,8 +38,8 @@ class QgsVectorLayerSaveAsDialog : public QDialog, private Ui::QgsVectorLayerSav
AllOptions = ~0 AllOptions = ~0
}; };
QgsVectorLayerSaveAsDialog( long srsid, QWidget* parent = 0, Qt::WindowFlags fl = 0 ); QgsVectorLayerSaveAsDialog( long srsid, QWidget* parent = nullptr, Qt::WindowFlags fl = nullptr );
QgsVectorLayerSaveAsDialog( long srsid, const QgsRectangle& layerExtent, bool layerHasSelectedFeatures, int options = AllOptions, QWidget* parent = 0, Qt::WindowFlags fl = 0 ); QgsVectorLayerSaveAsDialog( long srsid, const QgsRectangle& layerExtent, bool layerHasSelectedFeatures, int options = AllOptions, QWidget* parent = nullptr, Qt::WindowFlags fl = nullptr );
~QgsVectorLayerSaveAsDialog(); ~QgsVectorLayerSaveAsDialog();
QString format() const; QString format() const;

View File

@ -28,7 +28,7 @@ class QgsOSMDownloadDialog : public QDialog, private Ui::QgsOSMDownloadDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit QgsOSMDownloadDialog( QWidget* parent = 0 ); explicit QgsOSMDownloadDialog( QWidget* parent = nullptr );
~QgsOSMDownloadDialog(); ~QgsOSMDownloadDialog();
void setRect( const QgsRectangle& rect ); void setRect( const QgsRectangle& rect );

View File

@ -28,7 +28,7 @@ class QgsOSMExportDialog : public QDialog, private Ui::QgsOSMExportDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit QgsOSMExportDialog( QWidget *parent = 0 ); explicit QgsOSMExportDialog( QWidget *parent = nullptr );
~QgsOSMExportDialog(); ~QgsOSMExportDialog();
protected: protected:

View File

@ -26,7 +26,7 @@ class QgsOSMImportDialog : public QDialog, private Ui::QgsOSMImportDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit QgsOSMImportDialog( QWidget* parent = 0 ); explicit QgsOSMImportDialog( QWidget* parent = nullptr );
~QgsOSMImportDialog(); ~QgsOSMImportDialog();
private slots: private slots:

View File

@ -45,7 +45,7 @@ void QgsPluginItemDelegate::paint( QPainter *painter, const QStyleOptionViewItem
int pixelsHigh = QApplication::fontMetrics().height(); int pixelsHigh = QApplication::fontMetrics().height();
// Draw the background // Draw the background
style->drawPrimitive( QStyle::PE_PanelItemViewItem, &option, painter, NULL ); style->drawPrimitive( QStyle::PE_PanelItemViewItem, &option, painter, nullptr );
// Draw the checkbox // Draw the checkbox
if ( index.flags() & Qt::ItemIsUserCheckable ) if ( index.flags() & Qt::ItemIsUserCheckable )

View File

@ -26,7 +26,7 @@ class QgsPluginItemDelegate : public QStyledItemDelegate
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit QgsPluginItemDelegate( QObject * parent = 0 ); explicit QgsPluginItemDelegate( QObject * parent = nullptr );
QSize sizeHint( const QStyleOptionViewItem & theOption, const QModelIndex & theIndex ) const override; QSize sizeHint( const QStyleOptionViewItem & theOption, const QModelIndex & theIndex ) const override;
void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const override; void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
}; };

View File

@ -60,7 +60,7 @@ QgsPluginManager::QgsPluginManager( QWidget * parent, bool pluginsAreEnabled, Qt
: QgsOptionsDialogBase( "PluginManager", parent, fl ) : QgsOptionsDialogBase( "PluginManager", parent, fl )
{ {
// initialize pointer // initialize pointer
mPythonUtils = NULL; mPythonUtils = nullptr;
setupUi( this ); setupUi( this );
@ -912,7 +912,7 @@ const QMap<QString, QString> * QgsPluginManager::pluginMetadata( const QString&
{ {
return &it.value(); return &it.value();
} }
return NULL; return nullptr;
} }

View File

@ -47,7 +47,7 @@ class QgsPluginManager : public QgsOptionsDialogBase, private Ui::QgsPluginManag
Q_OBJECT Q_OBJECT
public: public:
//! Constructor; set pluginsAreEnabled to false in --noplugins mode //! Constructor; set pluginsAreEnabled to false in --noplugins mode
QgsPluginManager( QWidget *parent = 0, bool pluginsAreEnabled = true, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); QgsPluginManager( QWidget *parent = nullptr, bool pluginsAreEnabled = true, Qt::WindowFlags fl = QgisGui::ModalDialogFlags );
//! Destructor //! Destructor
~QgsPluginManager(); ~QgsPluginManager();

View File

@ -42,7 +42,7 @@ class QgsPluginSortFilterProxyModel : public QSortFilterProxyModel
Q_OBJECT Q_OBJECT
public: public:
explicit QgsPluginSortFilterProxyModel( QObject *parent = 0 ); explicit QgsPluginSortFilterProxyModel( QObject *parent = nullptr );
//! (Re)configire the status filter //! (Re)configire the status filter
void setAcceptedStatuses( const QStringList& statuses ); void setAcceptedStatuses( const QStringList& statuses );

View File

@ -521,42 +521,42 @@ static bool cmpByText_( QAction* a, QAction* b )
} }
QgisApp *QgisApp::smInstance = 0; QgisApp *QgisApp::smInstance = nullptr;
// constructor starts here // constructor starts here
QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, Qt::WindowFlags fl ) QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, Qt::WindowFlags fl )
: QMainWindow( parent, fl ) : QMainWindow( parent, fl )
, mNonEditMapTool( 0 ) , mNonEditMapTool( nullptr )
, mScaleLabel( 0 ) , mScaleLabel( nullptr )
, mScaleEdit( 0 ) , mScaleEdit( nullptr )
, mScaleEditValidator( 0 ) , mScaleEditValidator( nullptr )
, mCoordsEdit( 0 ) , mCoordsEdit( nullptr )
, mRotationLabel( 0 ) , mRotationLabel( nullptr )
, mRotationEdit( 0 ) , mRotationEdit( nullptr )
, mRotationEditValidator( 0 ) , mRotationEditValidator( nullptr )
, mProgressBar( 0 ) , mProgressBar( nullptr )
, mRenderSuppressionCBox( 0 ) , mRenderSuppressionCBox( nullptr )
, mOnTheFlyProjectionStatusLabel( 0 ) , mOnTheFlyProjectionStatusLabel( nullptr )
, mOnTheFlyProjectionStatusButton( 0 ) , mOnTheFlyProjectionStatusButton( nullptr )
, mMessageButton( 0 ) , mMessageButton( nullptr )
, mFeatureActionMenu( 0 ) , mFeatureActionMenu( nullptr )
, mPopupMenu( 0 ) , mPopupMenu( nullptr )
, mDatabaseMenu( 0 ) , mDatabaseMenu( nullptr )
, mWebMenu( 0 ) , mWebMenu( nullptr )
, mToolPopupOverviews( 0 ) , mToolPopupOverviews( nullptr )
, mToolPopupDisplay( 0 ) , mToolPopupDisplay( nullptr )
, mLayerTreeCanvasBridge( 0 ) , mLayerTreeCanvasBridge( nullptr )
, mSplash( splash ) , mSplash( splash )
, mInternalClipboard( 0 ) , mInternalClipboard( nullptr )
, mShowProjectionTab( false ) , mShowProjectionTab( false )
, mPythonUtils( 0 ) , mPythonUtils( nullptr )
, mComposerManager( 0 ) , mComposerManager( nullptr )
, mpTileScaleWidget( 0 ) , mpTileScaleWidget( nullptr )
, mpGpsWidget( 0 ) , mpGpsWidget( nullptr )
, mSnappingUtils( 0 ) , mSnappingUtils( nullptr )
, mProjectLastModified() , mProjectLastModified()
, mWelcomePage( 0 ) , mWelcomePage( nullptr )
, mCentralContainer( 0 ) , mCentralContainer( nullptr )
{ {
if ( smInstance ) if ( smInstance )
{ {
@ -657,7 +657,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
mLayerTreeView->setObjectName( "theLayerTreeView" ); // "theLayerTreeView" used to find this canonical instance later mLayerTreeView->setObjectName( "theLayerTreeView" ); // "theLayerTreeView" used to find this canonical instance later
// create undo widget // create undo widget
mUndoWidget = new QgsUndoWidget( NULL, mMapCanvas ); mUndoWidget = new QgsUndoWidget( nullptr, mMapCanvas );
mUndoWidget->setObjectName( "Undo" ); mUndoWidget->setObjectName( "Undo" );
// Advanced Digitizing dock // Advanced Digitizing dock
@ -743,7 +743,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
mpGpsDock->setWidget( mpGpsWidget ); mpGpsDock->setWidget( mpGpsWidget );
mpGpsDock->hide(); mpGpsDock->hide();
mLastMapToolMessage = 0; mLastMapToolMessage = nullptr;
mLogViewer = new QgsMessageLogViewer( statusBar(), this ); mLogViewer = new QgsMessageLogViewer( statusBar(), this );
@ -775,7 +775,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
addWindow( mWindowAction ); addWindow( mWindowAction );
#endif #endif
activateDeactivateLayerRelatedActions( NULL ); // after members were created activateDeactivateLayerRelatedActions( nullptr ); // after members were created
connect( QgsMapLayerActionRegistry::instance(), SIGNAL( changed() ), this, SLOT( refreshActionFeatureAction() ) ); connect( QgsMapLayerActionRegistry::instance(), SIGNAL( changed() ), this, SLOT( refreshActionFeatureAction() ) );
@ -839,7 +839,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
{ {
// python is disabled so get rid of the action for python console // python is disabled so get rid of the action for python console
delete mActionShowPythonDialog; delete mActionShowPythonDialog;
mActionShowPythonDialog = 0; mActionShowPythonDialog = nullptr;
} }
// Set icon size of toolbars // Set icon size of toolbars
@ -921,7 +921,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
#else #else
//remove mActionTouch button //remove mActionTouch button
delete mActionTouch; delete mActionTouch;
mActionTouch = 0; mActionTouch = nullptr;
#endif #endif
// supposedly all actions have been added, now register them to the shortcut manager // supposedly all actions have been added, now register them to the shortcut manager
@ -948,83 +948,83 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
} // QgisApp ctor } // QgisApp ctor
QgisApp::QgisApp() QgisApp::QgisApp()
: QMainWindow( 0, 0 ) : QMainWindow( nullptr, nullptr )
, mStyleSheetBuilder( 0 ) , mStyleSheetBuilder( nullptr )
, mActionPluginSeparator1( 0 ) , mActionPluginSeparator1( nullptr )
, mActionPluginSeparator2( 0 ) , mActionPluginSeparator2( nullptr )
, mActionRasterSeparator( 0 ) , mActionRasterSeparator( nullptr )
, mMapToolGroup( 0 ) , mMapToolGroup( nullptr )
, mPreviewGroup( 0 ) , mPreviewGroup( nullptr )
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
, mWindowMenu( 0 ) , mWindowMenu( 0 )
#endif #endif
, mPanelMenu( 0 ) , mPanelMenu( nullptr )
, mToolbarMenu( 0 ) , mToolbarMenu( nullptr )
, mLayerTreeDock( 0 ) , mLayerTreeDock( nullptr )
, mLayerOrderDock( 0 ) , mLayerOrderDock( nullptr )
, mOverviewDock( 0 ) , mOverviewDock( nullptr )
, mpGpsDock( 0 ) , mpGpsDock( nullptr )
, mLogDock( 0 ) , mLogDock( nullptr )
, mNonEditMapTool( 0 ) , mNonEditMapTool( nullptr )
, mScaleLabel( 0 ) , mScaleLabel( nullptr )
, mScaleEdit( 0 ) , mScaleEdit( nullptr )
, mScaleEditValidator( 0 ) , mScaleEditValidator( nullptr )
, mCoordsEdit( 0 ) , mCoordsEdit( nullptr )
, mRotationLabel( 0 ) , mRotationLabel( nullptr )
, mRotationEdit( 0 ) , mRotationEdit( nullptr )
, mRotationEditValidator( 0 ) , mRotationEditValidator( nullptr )
, mProgressBar( 0 ) , mProgressBar( nullptr )
, mRenderSuppressionCBox( 0 ) , mRenderSuppressionCBox( nullptr )
, mOnTheFlyProjectionStatusLabel( 0 ) , mOnTheFlyProjectionStatusLabel( nullptr )
, mOnTheFlyProjectionStatusButton( 0 ) , mOnTheFlyProjectionStatusButton( nullptr )
, mMessageButton( 0 ) , mMessageButton( nullptr )
, mFeatureActionMenu( 0 ) , mFeatureActionMenu( nullptr )
, mPopupMenu( 0 ) , mPopupMenu( nullptr )
, mDatabaseMenu( 0 ) , mDatabaseMenu( nullptr )
, mWebMenu( 0 ) , mWebMenu( nullptr )
, mToolPopupOverviews( 0 ) , mToolPopupOverviews( nullptr )
, mToolPopupDisplay( 0 ) , mToolPopupDisplay( nullptr )
, mMapCanvas( 0 ) , mMapCanvas( nullptr )
, mOverviewCanvas( 0 ) , mOverviewCanvas( nullptr )
, mLayerTreeView( 0 ) , mLayerTreeView( nullptr )
, mLayerTreeCanvasBridge( 0 ) , mLayerTreeCanvasBridge( nullptr )
, mMapLayerOrder( 0 ) , mMapLayerOrder( nullptr )
, mOverviewMapCursor( 0 ) , mOverviewMapCursor( nullptr )
, mMapWindow( 0 ) , mMapWindow( nullptr )
, mQgisInterface( 0 ) , mQgisInterface( nullptr )
, mSplash( 0 ) , mSplash( nullptr )
, mInternalClipboard( 0 ) , mInternalClipboard( nullptr )
, mShowProjectionTab( false ) , mShowProjectionTab( false )
, mpMapTipsTimer( 0 ) , mpMapTipsTimer( nullptr )
, mpMaptip( 0 ) , mpMaptip( nullptr )
, mMapTipsVisible( false ) , mMapTipsVisible( false )
, mFullScreenMode( false ) , mFullScreenMode( false )
, mPrevScreenModeMaximized( false ) , mPrevScreenModeMaximized( false )
, mSaveRollbackInProgress( false ) , mSaveRollbackInProgress( false )
, mPythonUtils( 0 ) , mPythonUtils( nullptr )
, mBrowserWidget( 0 ) , mBrowserWidget( nullptr )
, mBrowserWidget2( 0 ) , mBrowserWidget2( nullptr )
, mAdvancedDigitizingDockWidget( 0 ) , mAdvancedDigitizingDockWidget( nullptr )
, mStatisticalSummaryDockWidget( 0 ) , mStatisticalSummaryDockWidget( nullptr )
, mBookMarksDockWidget( 0 ) , mBookMarksDockWidget( nullptr )
, mSnappingDialog( 0 ) , mSnappingDialog( nullptr )
, mPluginManager( 0 ) , mPluginManager( nullptr )
, mComposerManager( 0 ) , mComposerManager( nullptr )
, mpTileScaleWidget( 0 ) , mpTileScaleWidget( nullptr )
, mLastComposerId( 0 ) , mLastComposerId( 0 )
, mpGpsWidget( 0 ) , mpGpsWidget( nullptr )
, mLastMapToolMessage( 0 ) , mLastMapToolMessage( nullptr )
, mLogViewer( 0 ) , mLogViewer( nullptr )
, mTrustedMacros( false ) , mTrustedMacros( false )
, mMacrosWarn( 0 ) , mMacrosWarn( nullptr )
, mUserInputDockWidget( 0 ) , mUserInputDockWidget( nullptr )
, mVectorLayerTools( 0 ) , mVectorLayerTools( nullptr )
, mActionFilterLegend( 0 ) , mActionFilterLegend( nullptr )
, mLegendExpressionFilterButton( 0 ) , mLegendExpressionFilterButton( nullptr )
, mSnappingUtils( 0 ) , mSnappingUtils( nullptr )
, mProjectLastModified() , mProjectLastModified()
, mWelcomePage( 0 ) , mWelcomePage( nullptr )
, mCentralContainer( 0 ) , mCentralContainer( nullptr )
, mProjOpen( 0 ) , mProjOpen( 0 )
{ {
smInstance = this; smInstance = this;
@ -1033,7 +1033,7 @@ QgisApp::QgisApp()
mMapCanvas = new QgsMapCanvas(); mMapCanvas = new QgsMapCanvas();
mMapCanvas->freeze(); mMapCanvas->freeze();
mLayerTreeView = new QgsLayerTreeView( this ); mLayerTreeView = new QgsLayerTreeView( this );
mUndoWidget = new QgsUndoWidget( NULL, mMapCanvas ); mUndoWidget = new QgsUndoWidget( nullptr, mMapCanvas );
mInfoBar = new QgsMessageBar( centralWidget() ); mInfoBar = new QgsMessageBar( centralWidget() );
// More tests may need more members to be initialized // More tests may need more members to be initialized
} }
@ -1104,7 +1104,7 @@ QgisApp::~QgisApp()
removeAnnotationItems(); removeAnnotationItems();
// cancel request for FileOpen events // cancel request for FileOpen events
QgsApplication::setFileOpenEventReceiver( 0 ); QgsApplication::setFileOpenEventReceiver( nullptr );
QgsApplication::exitQgis(); QgsApplication::exitQgis();
@ -1306,9 +1306,9 @@ void QgisApp::readSettings()
void QgisApp::createActions() void QgisApp::createActions()
{ {
mActionPluginSeparator1 = NULL; // plugin list separator will be created when the first plugin is loaded mActionPluginSeparator1 = nullptr; // plugin list separator will be created when the first plugin is loaded
mActionPluginSeparator2 = NULL; // python separator will be created only if python is found mActionPluginSeparator2 = nullptr; // python separator will be created only if python is found
mActionRasterSeparator = NULL; // raster plugins list separator will be created when the first plugin is loaded mActionRasterSeparator = nullptr; // raster plugins list separator will be created when the first plugin is loaded
// Project Menu Items // Project Menu Items
@ -1540,7 +1540,7 @@ void QgisApp::createActions()
#ifndef HAVE_ORACLE #ifndef HAVE_ORACLE
delete mActionAddOracleLayer; delete mActionAddOracleLayer;
mActionAddOracleLayer = 0; mActionAddOracleLayer = nullptr;
#endif #endif
} }
@ -1699,7 +1699,7 @@ void QgisApp::createMenus()
// Get platform for menu layout customization (Gnome, Kde, Mac, Win) // Get platform for menu layout customization (Gnome, Kde, Mac, Win)
QDialogButtonBox::ButtonLayout layout = QDialogButtonBox::ButtonLayout layout =
QDialogButtonBox::ButtonLayout( style()->styleHint( QStyle::SH_DialogButtonLayout, 0, this ) ); QDialogButtonBox::ButtonLayout( style()->styleHint( QStyle::SH_DialogButtonLayout, nullptr, this ) );
// Project Menu // Project Menu
@ -2498,7 +2498,7 @@ void QgisApp::createCanvasTools()
void QgisApp::createOverview() void QgisApp::createOverview()
{ {
// overview canvas // overview canvas
mOverviewCanvas = new QgsMapOverviewCanvas( NULL, mMapCanvas ); mOverviewCanvas = new QgsMapOverviewCanvas( nullptr, mMapCanvas );
//set canvas color to default //set canvas color to default
QSettings settings; QSettings settings;
@ -3005,7 +3005,7 @@ void QgisApp::sponsors()
void QgisApp::about() void QgisApp::about()
{ {
static QgsAbout *abt = NULL; static QgsAbout *abt = nullptr;
if ( !abt ) if ( !abt )
{ {
QApplication::setOverrideCursor( Qt::WaitCursor ); QApplication::setOverrideCursor( Qt::WaitCursor );
@ -3271,7 +3271,7 @@ bool QgisApp::askUserForZipItemLayers( QString path )
{ {
bool ok = false; bool ok = false;
QVector<QgsDataItem*> childItems; QVector<QgsDataItem*> childItems;
QgsZipItem *zipItem = 0; QgsZipItem *zipItem = nullptr;
QSettings settings; QSettings settings;
int promptLayers = settings.value( "/qgis/promptForRasterSublayers", 1 ).toInt(); int promptLayers = settings.value( "/qgis/promptForRasterSublayers", 1 ).toInt();
@ -3283,7 +3283,7 @@ bool QgisApp::askUserForZipItemLayers( QString path )
return false; return false;
} }
zipItem = new QgsZipItem( 0, path, path ); zipItem = new QgsZipItem( nullptr, path, path );
if ( ! zipItem ) if ( ! zipItem )
return false; return false;
@ -3469,7 +3469,7 @@ bool QgisApp::shouldAskUserForGDALSublayers( QgsRasterLayer *layer )
void QgisApp::loadGDALSublayers( const QString& uri, const QStringList& list ) void QgisApp::loadGDALSublayers( const QString& uri, const QStringList& list )
{ {
QString path, name; QString path, name;
QgsRasterLayer *subLayer = NULL; QgsRasterLayer *subLayer = nullptr;
//add layers in reverse order so they appear in the right order in the layer dock //add layers in reverse order so they appear in the right order in the layer dock
for ( int i = list.size() - 1; i >= 0 ; i-- ) for ( int i = list.size() - 1; i >= 0 ; i-- )
@ -4560,7 +4560,7 @@ void QgisApp::openProject( QAction *action )
{ {
// possibly save any pending work before opening a different project // possibly save any pending work before opening a different project
QString debugme; QString debugme;
assert( action != NULL ); assert( action != nullptr );
debugme = action->data().toString(); debugme = action->data().toString();
@ -4710,7 +4710,7 @@ void QgisApp::showComposerManager()
{ {
if ( !mComposerManager ) if ( !mComposerManager )
{ {
mComposerManager = new QgsComposerManager( 0, Qt::Window ); mComposerManager = new QgsComposerManager( nullptr, Qt::Window );
connect( mComposerManager, SIGNAL( finished( int ) ), this, SLOT( deleteComposerManager() ) ); connect( mComposerManager, SIGNAL( finished( int ) ), this, SLOT( deleteComposerManager() ) );
} }
mComposerManager->show(); mComposerManager->show();
@ -4720,7 +4720,7 @@ void QgisApp::showComposerManager()
void QgisApp::deleteComposerManager() void QgisApp::deleteComposerManager()
{ {
mComposerManager->deleteLater(); mComposerManager->deleteLater();
mComposerManager = 0; mComposerManager = nullptr;
} }
void QgisApp::disablePreviewMode() void QgisApp::disablePreviewMode()
@ -4779,7 +4779,7 @@ void QgisApp::updateFilterLegend()
} }
else else
{ {
layerTreeView()->layerTreeModel()->setLegendFilterByMap( 0 ); layerTreeView()->layerTreeModel()->setLegendFilterByMap( nullptr );
} }
} }
@ -4789,7 +4789,7 @@ void QgisApp::saveMapAsImage()
if ( myFileNameAndFilter.first != "" ) if ( myFileNameAndFilter.first != "" )
{ {
//save the mapview to the selected file //save the mapview to the selected file
mMapCanvas->saveAsImage( myFileNameAndFilter.first, NULL, myFileNameAndFilter.second ); mMapCanvas->saveAsImage( myFileNameAndFilter.first, nullptr, myFileNameAndFilter.second );
statusBar()->showMessage( tr( "Saved map image to %1" ).arg( myFileNameAndFilter.first ) ); statusBar()->showMessage( tr( "Saved map image to %1" ).arg( myFileNameAndFilter.first ) );
} }
@ -5066,7 +5066,7 @@ void QgisApp::updateDefaultFeatureAction( QAction *action )
if ( vlayer->actions()->size() > 0 && index < vlayer->actions()->size() ) if ( vlayer->actions()->size() > 0 && index < vlayer->actions()->size() )
{ {
vlayer->actions()->setDefaultAction( index ); vlayer->actions()->setDefaultAction( index );
QgsMapLayerActionRegistry::instance()->setDefaultActionForLayer( vlayer, 0 ); QgsMapLayerActionRegistry::instance()->setDefaultActionForLayer( vlayer, nullptr );
} }
else else
{ {
@ -5080,7 +5080,7 @@ void QgisApp::updateDefaultFeatureAction( QAction *action )
} }
else else
{ {
QgsMapLayerActionRegistry::instance()->setDefaultActionForLayer( vlayer, 0 ); QgsMapLayerActionRegistry::instance()->setDefaultActionForLayer( vlayer, nullptr );
} }
} }
@ -5367,7 +5367,7 @@ void QgisApp::saveAsRasterFile()
fileWriter.setMaxTileHeight( d.maximumTileSizeY() ); fileWriter.setMaxTileHeight( d.maximumTileSizeY() );
} }
QProgressDialog pd( 0, tr( "Abort..." ), 0, 0 ); QProgressDialog pd( nullptr, tr( "Abort..." ), 0, 0 );
// Show the dialo immediately because cloning pipe can take some time (WCS) // Show the dialo immediately because cloning pipe can take some time (WCS)
pd.setLabelText( tr( "Reading raster" ) ); pd.setLabelText( tr( "Reading raster" ) );
pd.setWindowTitle( tr( "Saving raster" ) ); pd.setWindowTitle( tr( "Saving raster" ) );
@ -5377,7 +5377,7 @@ void QgisApp::saveAsRasterFile()
// TODO: show error dialogs // TODO: show error dialogs
// TODO: this code should go somewhere else, but probably not into QgsRasterFileWriter // TODO: this code should go somewhere else, but probably not into QgsRasterFileWriter
// clone pipe/provider is not really necessary, ready for threads // clone pipe/provider is not really necessary, ready for threads
QScopedPointer<QgsRasterPipe> pipe( 0 ); QScopedPointer<QgsRasterPipe> pipe( nullptr );
if ( d.mode() == QgsRasterLayerSaveAsDialog::RawDataMode ) if ( d.mode() == QgsRasterLayerSaveAsDialog::RawDataMode )
{ {
@ -5526,7 +5526,7 @@ void QgisApp::saveAsVectorFileGeneral( QgsVectorLayer* vlayer, bool symbologyOpt
bool autoGeometryType = dialog->automaticGeometryType(); bool autoGeometryType = dialog->automaticGeometryType();
QgsWKBTypes::Type forcedGeometryType = dialog->geometryType(); QgsWKBTypes::Type forcedGeometryType = dialog->geometryType();
QgsCoordinateTransform* ct = 0; QgsCoordinateTransform* ct = nullptr;
destCRS = QgsCoordinateReferenceSystem( dialog->crs(), QgsCoordinateReferenceSystem::InternalCrsId ); destCRS = QgsCoordinateReferenceSystem( dialog->crs(), QgsCoordinateReferenceSystem::InternalCrsId );
if ( destCRS.isValid() && destCRS != vlayer->crs() ) if ( destCRS.isValid() && destCRS != vlayer->crs() )
@ -5571,7 +5571,7 @@ void QgisApp::saveAsVectorFileGeneral( QgsVectorLayer* vlayer, bool symbologyOpt
&newFilename, &newFilename,
( QgsVectorFileWriter::SymbologyExport )( dialog->symbologyExport() ), ( QgsVectorFileWriter::SymbologyExport )( dialog->symbologyExport() ),
dialog->scaleDenominator(), dialog->scaleDenominator(),
dialog->hasFilterExtent() ? &filterExtent : 0, dialog->hasFilterExtent() ? &filterExtent : nullptr,
autoGeometryType ? QgsWKBTypes::Unknown : forcedGeometryType, autoGeometryType ? QgsWKBTypes::Unknown : forcedGeometryType,
dialog->forceMulti(), dialog->forceMulti(),
dialog->includeZ() dialog->includeZ()
@ -5594,7 +5594,7 @@ void QgisApp::saveAsVectorFileGeneral( QgsVectorLayer* vlayer, bool symbologyOpt
} }
else else
{ {
QgsMessageViewer *m = new QgsMessageViewer( 0 ); QgsMessageViewer *m = new QgsMessageViewer( nullptr );
m->setWindowTitle( tr( "Save error" ) ); m->setWindowTitle( tr( "Save error" ) );
m->setMessageAsPlainText( tr( "Export to vector file failed.\nError: %1" ).arg( errorMessage ) ); m->setMessageAsPlainText( tr( "Export to vector file failed.\nError: %1" ).arg( errorMessage ) );
m->exec(); m->exec();
@ -5751,14 +5751,14 @@ QgsGeometry* QgisApp::unionGeometries( const QgsVectorLayer* vl, QgsFeatureList&
canceled = false; canceled = false;
if ( !vl || featureList.size() < 2 ) if ( !vl || featureList.size() < 2 )
{ {
return 0; return nullptr;
} }
QgsGeometry* unionGeom = featureList[0].geometry(); QgsGeometry* unionGeom = featureList[0].geometry();
QgsGeometry* backupPtr = 0; //pointer to delete intermediate results QgsGeometry* backupPtr = nullptr; //pointer to delete intermediate results
if ( !unionGeom ) if ( !unionGeom )
{ {
return 0; return nullptr;
} }
QProgressDialog progress( tr( "Merging features..." ), tr( "Abort" ), 0, featureList.size(), this ); QProgressDialog progress( tr( "Merging features..." ), tr( "Abort" ), 0, featureList.size(), this );
@ -5773,7 +5773,7 @@ QgsGeometry* QgisApp::unionGeometries( const QgsVectorLayer* vl, QgsFeatureList&
delete unionGeom; delete unionGeom;
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
canceled = true; canceled = true;
return 0; return nullptr;
} }
progress.setValue( i ); progress.setValue( i );
QgsGeometry* currentGeom = featureList[i].geometry(); QgsGeometry* currentGeom = featureList[i].geometry();
@ -5784,12 +5784,12 @@ QgsGeometry* QgisApp::unionGeometries( const QgsVectorLayer* vl, QgsFeatureList&
if ( i > 1 ) //delete previous intermediate results if ( i > 1 ) //delete previous intermediate results
{ {
delete backupPtr; delete backupPtr;
backupPtr = 0; backupPtr = nullptr;
} }
if ( !unionGeom ) if ( !unionGeom )
{ {
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
return 0; return nullptr;
} }
} }
} }
@ -5917,7 +5917,7 @@ void QgisApp::deleteComposer( QgsComposer* c )
QgsComposer* QgisApp::duplicateComposer( QgsComposer* currentComposer, QString title ) QgsComposer* QgisApp::duplicateComposer( QgsComposer* currentComposer, QString title )
{ {
QgsComposer* newComposer = 0; QgsComposer* newComposer = nullptr;
// test that current composer template write is valid // test that current composer template write is valid
QDomDocument currentDoc; QDomDocument currentDoc;
@ -5945,10 +5945,10 @@ QgsComposer* QgisApp::duplicateComposer( QgsComposer* currentComposer, QString t
// hiding composer until template is loaded is much faster, provide feedback to user // hiding composer until template is loaded is much faster, provide feedback to user
newComposer->hide(); newComposer->hide();
QApplication::setOverrideCursor( Qt::BusyCursor ); QApplication::setOverrideCursor( Qt::BusyCursor );
if ( !newComposer->composition()->loadFromTemplate( currentDoc, 0, false ) ) if ( !newComposer->composition()->loadFromTemplate( currentDoc, nullptr, false ) )
{ {
deleteComposer( newComposer ); deleteComposer( newComposer );
newComposer = 0; newComposer = nullptr;
QgsDebugMsg( "Error, composer could not be duplicated" ); QgsDebugMsg( "Error, composer could not be duplicated" );
return newComposer; return newComposer;
} }
@ -6180,13 +6180,13 @@ void QgisApp::mergeAttributesOfSelectedFeatures()
QgsVectorLayer* vl = qobject_cast<QgsVectorLayer *>( activeMapLayer ); QgsVectorLayer* vl = qobject_cast<QgsVectorLayer *>( activeMapLayer );
if ( !vl ) if ( !vl )
{ {
QMessageBox::information( 0, tr( "Active layer is not vector" ), tr( "The merge features tool only works on vector layers. Please select a vector layer from the layer list" ) ); QMessageBox::information( nullptr, tr( "Active layer is not vector" ), tr( "The merge features tool only works on vector layers. Please select a vector layer from the layer list" ) );
return; return;
} }
if ( !vl->isEditable() ) if ( !vl->isEditable() )
{ {
QMessageBox::information( 0, tr( "Layer not editable" ), tr( "Merging features can only be done for layers in editing mode. To use the merge tool, go to Layer->Toggle editing" ) ); QMessageBox::information( nullptr, tr( "Layer not editable" ), tr( "Merging features can only be done for layers in editing mode. To use the merge tool, go to Layer->Toggle editing" ) );
return; return;
} }
@ -6194,7 +6194,7 @@ void QgisApp::mergeAttributesOfSelectedFeatures()
const QgsFeatureIds& featureIdSet = vl->selectedFeaturesIds(); const QgsFeatureIds& featureIdSet = vl->selectedFeaturesIds();
if ( featureIdSet.size() < 2 ) if ( featureIdSet.size() < 2 )
{ {
QMessageBox::information( 0, tr( "Not enough features selected" ), tr( "The merge tool requires at least two selected features" ) ); QMessageBox::information( nullptr, tr( "Not enough features selected" ), tr( "The merge tool requires at least two selected features" ) );
return; return;
} }
@ -6263,18 +6263,18 @@ void QgisApp::mergeSelectedFeatures()
QgsMapLayer* activeMapLayer = activeLayer(); QgsMapLayer* activeMapLayer = activeLayer();
if ( !activeMapLayer ) if ( !activeMapLayer )
{ {
QMessageBox::information( 0, tr( "No active layer" ), tr( "No active layer found. Please select a layer in the layer list" ) ); QMessageBox::information( nullptr, tr( "No active layer" ), tr( "No active layer found. Please select a layer in the layer list" ) );
return; return;
} }
QgsVectorLayer* vl = qobject_cast<QgsVectorLayer *>( activeMapLayer ); QgsVectorLayer* vl = qobject_cast<QgsVectorLayer *>( activeMapLayer );
if ( !vl ) if ( !vl )
{ {
QMessageBox::information( 0, tr( "Active layer is not vector" ), tr( "The merge features tool only works on vector layers. Please select a vector layer from the layer list" ) ); QMessageBox::information( nullptr, tr( "Active layer is not vector" ), tr( "The merge features tool only works on vector layers. Please select a vector layer from the layer list" ) );
return; return;
} }
if ( !vl->isEditable() ) if ( !vl->isEditable() )
{ {
QMessageBox::information( 0, tr( "Layer not editable" ), tr( "Merging features can only be done for layers in editing mode. To use the merge tool, go to Layer->Toggle editing" ) ); QMessageBox::information( nullptr, tr( "Layer not editable" ), tr( "Merging features can only be done for layers in editing mode. To use the merge tool, go to Layer->Toggle editing" ) );
return; return;
} }
@ -6289,7 +6289,7 @@ void QgisApp::mergeSelectedFeatures()
const QgsFeatureIds& featureIdSet = vl->selectedFeaturesIds(); const QgsFeatureIds& featureIdSet = vl->selectedFeaturesIds();
if ( featureIdSet.size() < 2 ) if ( featureIdSet.size() < 2 )
{ {
QMessageBox::information( 0, tr( "Not enough features selected" ), tr( "The merge tool requires at least two selected features" ) ); QMessageBox::information( nullptr, tr( "Not enough features selected" ), tr( "The merge tool requires at least two selected features" ) );
return; return;
} }
@ -6302,7 +6302,7 @@ void QgisApp::mergeSelectedFeatures()
{ {
if ( !canceled ) if ( !canceled )
{ {
QMessageBox::critical( 0, tr( "Merge failed" ), tr( "An error occured during the merge operation" ) ); QMessageBox::critical( nullptr, tr( "Merge failed" ), tr( "An error occured during the merge operation" ) );
} }
return; return;
} }
@ -6310,7 +6310,7 @@ void QgisApp::mergeSelectedFeatures()
//make a first geometry union and notify the user straight away if the union geometry type does not match the layer one //make a first geometry union and notify the user straight away if the union geometry type does not match the layer one
if ( providerChecksTypeStrictly && unionGeom->wkbType() != vl->wkbType() ) if ( providerChecksTypeStrictly && unionGeom->wkbType() != vl->wkbType() )
{ {
QMessageBox::critical( 0, tr( "Union operation canceled" ), tr( "The union operation would result in a geometry type that is not compatible with the current layer and therefore is canceled" ) ); QMessageBox::critical( nullptr, tr( "Union operation canceled" ), tr( "The union operation would result in a geometry type that is not compatible with the current layer and therefore is canceled" ) );
delete unionGeom; delete unionGeom;
return; return;
} }
@ -6327,7 +6327,7 @@ void QgisApp::mergeSelectedFeatures()
if ( featureIdsAfter.size() < 2 ) if ( featureIdsAfter.size() < 2 )
{ {
QMessageBox::information( 0, tr( "Not enough features selected" ), tr( "The merge tool requires at least two selected features" ) ); QMessageBox::information( nullptr, tr( "Not enough features selected" ), tr( "The merge tool requires at least two selected features" ) );
delete unionGeom; delete unionGeom;
return; return;
} }
@ -6343,14 +6343,14 @@ void QgisApp::mergeSelectedFeatures()
{ {
if ( !canceled ) if ( !canceled )
{ {
QMessageBox::critical( 0, tr( "Merge failed" ), tr( "An error occured during the merge operation" ) ); QMessageBox::critical( nullptr, tr( "Merge failed" ), tr( "An error occured during the merge operation" ) );
} }
return; return;
} }
if ( providerChecksTypeStrictly && unionGeom->wkbType() != vl->wkbType() ) if ( providerChecksTypeStrictly && unionGeom->wkbType() != vl->wkbType() )
{ {
QMessageBox::critical( 0, "Union operation canceled", tr( "The union operation would result in a geometry type that is not compatible with the current layer and therefore is canceled" ) ); QMessageBox::critical( nullptr, "Union operation canceled", tr( "The union operation would result in a geometry type that is not compatible with the current layer and therefore is canceled" ) );
delete unionGeom; delete unionGeom;
return; return;
} }
@ -6689,7 +6689,7 @@ QgsVectorLayer *QgisApp::pasteAsNewMemoryVector( const QString & theLayerName )
tr( "Layer name" ), QLineEdit::Normal, tr( "Layer name" ), QLineEdit::Normal,
defaultName, &ok ); defaultName, &ok );
if ( !ok ) if ( !ok )
return 0; return nullptr;
if ( layerName.isEmpty() ) if ( layerName.isEmpty() )
{ {
@ -6699,7 +6699,7 @@ QgsVectorLayer *QgisApp::pasteAsNewMemoryVector( const QString & theLayerName )
QgsVectorLayer *layer = pasteToNewMemoryVector(); QgsVectorLayer *layer = pasteToNewMemoryVector();
if ( !layer ) if ( !layer )
return 0; return nullptr;
layer->setLayerName( layerName ); layer->setLayerName( layerName );
@ -6778,7 +6778,7 @@ QgsVectorLayer *QgisApp::pasteToNewMemoryVector()
if ( !message.isEmpty() ) if ( !message.isEmpty() )
{ {
QMessageBox::warning( this, tr( "Warning" ), message, QMessageBox::Ok ); QMessageBox::warning( this, tr( "Warning" ), message, QMessageBox::Ok );
return 0; return nullptr;
} }
QgsVectorLayer *layer = new QgsVectorLayer( typeName, "pasted_features", "memory" ); QgsVectorLayer *layer = new QgsVectorLayer( typeName, "pasted_features", "memory" );
@ -6787,7 +6787,7 @@ QgsVectorLayer *QgisApp::pasteToNewMemoryVector()
{ {
delete layer; delete layer;
QMessageBox::warning( this, tr( "Warning" ), tr( "Cannot create new layer" ), QMessageBox::Ok ); QMessageBox::warning( this, tr( "Warning" ), tr( "Cannot create new layer" ), QMessageBox::Ok );
return 0; return nullptr;
} }
layer->startEditing(); layer->startEditing();
@ -6802,7 +6802,7 @@ QgsVectorLayer *QgisApp::pasteToNewMemoryVector()
tr( "Cannot create field %1 (%2,%3)" ).arg( f.name(), f.typeName(), QVariant::typeToName( f.type() ) ), tr( "Cannot create field %1 (%2,%3)" ).arg( f.name(), f.typeName(), QVariant::typeToName( f.type() ) ),
QMessageBox::Ok ); QMessageBox::Ok );
delete layer; delete layer;
return 0; return nullptr;
} }
} }
@ -6819,7 +6819,7 @@ QgsVectorLayer *QgisApp::pasteToNewMemoryVector()
if ( QGis::singleType( wkbType ) != QGis::singleType( type ) ) if ( QGis::singleType( wkbType ) != QGis::singleType( type ) )
{ {
feature.setGeometry( 0 ); feature.setGeometry( nullptr );
} }
if ( QGis::isMultiType( wkbType ) && QGis::isSingleType( type ) ) if ( QGis::isMultiType( wkbType ) && QGis::isSingleType( type ) )
@ -6831,7 +6831,7 @@ QgsVectorLayer *QgisApp::pasteToNewMemoryVector()
{ {
QgsDebugMsg( "Cannot add features or commit changes" ); QgsDebugMsg( "Cannot add features or commit changes" );
delete layer; delete layer;
return 0; return nullptr;
} }
layer->removeSelection(); layer->removeSelection();
@ -7038,7 +7038,7 @@ bool QgisApp::toggleEditing( QgsMapLayer *layer, bool allowCancel )
if ( allowCancel ) if ( allowCancel )
buttons |= QMessageBox::Cancel; buttons |= QMessageBox::Cancel;
switch ( QMessageBox::information( 0, switch ( QMessageBox::information( nullptr,
tr( "Stop editing" ), tr( "Stop editing" ),
tr( "Do you want to save the changes to layer %1?" ).arg( vlayer->name() ), tr( "Do you want to save the changes to layer %1?" ).arg( vlayer->name() ),
buttons ) ) buttons ) )
@ -7149,7 +7149,7 @@ void QgisApp::cancelEdits( QgsMapLayer *layer, bool leaveEditable, bool triggerR
if ( !vlayer->rollBack( !leaveEditable ) ) if ( !vlayer->rollBack( !leaveEditable ) )
{ {
mSaveRollbackInProgress = false; mSaveRollbackInProgress = false;
QMessageBox::information( 0, QMessageBox::information( nullptr,
tr( "Error" ), tr( "Error" ),
tr( "Could not %1 changes to layer %2\n\nErrors: %3\n" ) tr( "Could not %1 changes to layer %2\n\nErrors: %3\n" )
.arg( leaveEditable ? tr( "rollback" ) : tr( "cancel" ), .arg( leaveEditable ? tr( "rollback" ) : tr( "cancel" ),
@ -7249,7 +7249,7 @@ void QgisApp::cancelAllEdits( bool verifyAction )
bool QgisApp::verifyEditsActionDialog( const QString& act, const QString& upon ) bool QgisApp::verifyEditsActionDialog( const QString& act, const QString& upon )
{ {
bool res = false; bool res = false;
switch ( QMessageBox::information( 0, switch ( QMessageBox::information( nullptr,
tr( "Current edits" ), tr( "Current edits" ),
tr( "%1 current changes for %2 layer(s)?" ) tr( "%1 current changes for %2 layer(s)?" )
.arg( act, .arg( act,
@ -7480,7 +7480,7 @@ void QgisApp::duplicateLayers( const QList<QgsMapLayer *>& lyrList )
Q_FOREACH ( QgsMapLayer * selectedLyr, selectedLyrs ) Q_FOREACH ( QgsMapLayer * selectedLyr, selectedLyrs )
{ {
dupLayer = 0; dupLayer = nullptr;
unSppType.clear(); unSppType.clear();
layerDupName = selectedLyr->name() + ' ' + tr( "copy" ); layerDupName = selectedLyr->name() + ' ' + tr( "copy" );
@ -7576,7 +7576,7 @@ void QgisApp::duplicateLayers( const QList<QgsMapLayer *>& lyrList )
} }
} }
dupLayer = 0; dupLayer = nullptr;
mMapCanvas->freeze( false ); mMapCanvas->freeze( false );
@ -8234,7 +8234,7 @@ void QgisApp::openURL( QString url, bool useQgisDocDirectory )
/** Get a pointer to the currently selected map layer */ /** Get a pointer to the currently selected map layer */
QgsMapLayer *QgisApp::activeLayer() QgsMapLayer *QgisApp::activeLayer()
{ {
return mLayerTreeView ? mLayerTreeView->currentLayer() : 0; return mLayerTreeView ? mLayerTreeView->currentLayer() : nullptr;
} }
/** Set the current layer */ /** Set the current layer */
@ -8303,7 +8303,7 @@ QgsVectorLayer* QgisApp::addVectorLayer( const QString& vectorLayerPath, const Q
// The first layer loaded is not useful in that case. The user can select it in // The first layer loaded is not useful in that case. The user can select it in
// the list if he wants to load it. // the list if he wants to load it.
delete layer; delete layer;
layer = 0; layer = nullptr;
} }
else else
{ {
@ -8322,7 +8322,7 @@ QgsVectorLayer* QgisApp::addVectorLayer( const QString& vectorLayerPath, const Q
delete layer; delete layer;
mMapCanvas->freeze( false ); mMapCanvas->freeze( false );
return NULL; return nullptr;
} }
// Only update the map if we frozen in this method // Only update the map if we frozen in this method
@ -8633,7 +8633,7 @@ void QgisApp::removePluginMenu( const QString& name, QAction* action )
if ( actions.indexOf( mActionPluginSeparator1 ) + 1 == end ) if ( actions.indexOf( mActionPluginSeparator1 ) + 1 == end )
{ {
mPluginMenu->removeAction( mActionPluginSeparator1 ); mPluginMenu->removeAction( mActionPluginSeparator1 );
mActionPluginSeparator1 = NULL; mActionPluginSeparator1 = nullptr;
} }
} }
@ -8647,7 +8647,7 @@ QMenu* QgisApp::getDatabaseMenu( const QString& menuName )
QString dst = cleanedMenuName; QString dst = cleanedMenuName;
dst.remove( QChar( '&' ) ); dst.remove( QChar( '&' ) );
QAction *before = NULL; QAction *before = nullptr;
QList<QAction*> actions = mDatabaseMenu->actions(); QList<QAction*> actions = mDatabaseMenu->actions();
for ( int i = 0; i < actions.count(); i++ ) for ( int i = 0; i < actions.count(); i++ )
{ {
@ -8686,7 +8686,7 @@ QMenu* QgisApp::getRasterMenu( const QString& menuName )
cleanedMenuName.remove( QChar( '&' ) ); cleanedMenuName.remove( QChar( '&' ) );
#endif #endif
QAction *before = NULL; QAction *before = nullptr;
if ( !mActionRasterSeparator ) if ( !mActionRasterSeparator )
{ {
// First plugin - create plugin list separator // First plugin - create plugin list separator
@ -8739,7 +8739,7 @@ QMenu* QgisApp::getVectorMenu( const QString& menuName )
QString dst = cleanedMenuName; QString dst = cleanedMenuName;
dst.remove( QChar( '&' ) ); dst.remove( QChar( '&' ) );
QAction *before = NULL; QAction *before = nullptr;
QList<QAction*> actions = mVectorMenu->actions(); QList<QAction*> actions = mVectorMenu->actions();
for ( int i = 0; i < actions.count(); i++ ) for ( int i = 0; i < actions.count(); i++ )
{ {
@ -8780,7 +8780,7 @@ QMenu* QgisApp::getWebMenu( const QString& menuName )
QString dst = cleanedMenuName; QString dst = cleanedMenuName;
dst.remove( QChar( '&' ) ); dst.remove( QChar( '&' ) );
QAction *before = NULL; QAction *before = nullptr;
QList<QAction*> actions = mWebMenu->actions(); QList<QAction*> actions = mWebMenu->actions();
for ( int i = 0; i < actions.count(); i++ ) for ( int i = 0; i < actions.count(); i++ )
{ {
@ -8830,7 +8830,7 @@ void QgisApp::addPluginToDatabaseMenu( const QString& name, QAction* action )
if ( mDatabaseMenu->actions().count() != 1 ) if ( mDatabaseMenu->actions().count() != 1 )
return; return;
QAction* before = NULL; QAction* before = nullptr;
QList<QAction*> actions = menuBar()->actions(); QList<QAction*> actions = menuBar()->actions();
for ( int i = 0; i < actions.count(); i++ ) for ( int i = 0; i < actions.count(); i++ )
{ {
@ -8884,7 +8884,7 @@ void QgisApp::addPluginToWebMenu( const QString& name, QAction* action )
if ( mWebMenu->actions().count() != 1 ) if ( mWebMenu->actions().count() != 1 )
return; return;
QAction* before = NULL; QAction* before = nullptr;
QList<QAction*> actions = menuBar()->actions(); QList<QAction*> actions = menuBar()->actions();
for ( int i = 0; i < actions.count(); i++ ) for ( int i = 0; i < actions.count(); i++ )
{ {
@ -8956,7 +8956,7 @@ void QgisApp::removePluginRasterMenu( const QString& name, QAction* action )
if ( actions.indexOf( mActionRasterSeparator ) + 1 == actions.count() ) if ( actions.indexOf( mActionRasterSeparator ) + 1 == actions.count() )
{ {
mRasterMenu->removeAction( mActionRasterSeparator ); mRasterMenu->removeAction( mActionRasterSeparator );
mActionRasterSeparator = NULL; mActionRasterSeparator = nullptr;
} }
} }
@ -9202,7 +9202,7 @@ void QgisApp::layersWereAdded( const QList<QgsMapLayer *>& theLayers )
for ( int i = 0; i < theLayers.size(); ++i ) for ( int i = 0; i < theLayers.size(); ++i )
{ {
QgsMapLayer * layer = theLayers.at( i ); QgsMapLayer * layer = theLayers.at( i );
QgsDataProvider *provider = 0; QgsDataProvider *provider = nullptr;
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer ); QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
if ( vlayer ) if ( vlayer )
@ -9420,7 +9420,7 @@ void QgisApp::legendLayerSelectionChanged( void )
mActionCancelEdits->setEnabled( QgsLayerTreeUtils::layersEditable( selectedLayers ) ); mActionCancelEdits->setEnabled( QgsLayerTreeUtils::layersEditable( selectedLayers ) );
mLegendExpressionFilterButton->setEnabled( false ); mLegendExpressionFilterButton->setEnabled( false );
mLegendExpressionFilterButton->setVectorLayer( 0 ); mLegendExpressionFilterButton->setVectorLayer( nullptr );
if ( selectedLayers.size() == 1 ) if ( selectedLayers.size() == 1 )
{ {
QgsLayerTreeLayer* l = selectedLayers.front(); QgsLayerTreeLayer* l = selectedLayers.front();
@ -9840,7 +9840,7 @@ void QgisApp::refreshActionFeatureAction()
{ {
QgsMapLayer* layer = activeLayer(); QgsMapLayer* layer = activeLayer();
if ( layer == 0 || layer->type() != QgsMapLayer::VectorLayer ) if ( layer == nullptr || layer->type() != QgsMapLayer::VectorLayer )
{ {
return; return;
} }
@ -9934,7 +9934,7 @@ QgsRasterLayer* QgisApp::addRasterLayerPrivate(
QgsDebugMsg( "Creating new raster layer using " + uri QgsDebugMsg( "Creating new raster layer using " + uri
+ " with baseName of " + baseName ); + " with baseName of " + baseName );
QgsRasterLayer *layer = 0; QgsRasterLayer *layer = nullptr;
// XXX ya know QgsRasterLayer can snip out the basename on its own; // XXX ya know QgsRasterLayer can snip out the basename on its own;
// XXX why do we have to pass it in for it? // XXX why do we have to pass it in for it?
// ET : we may not be getting "normal" files here, so we still need the baseName argument // ET : we may not be getting "normal" files here, so we still need the baseName argument
@ -9968,7 +9968,7 @@ QgsRasterLayer* QgisApp::addRasterLayerPrivate(
// The first layer loaded is not useful in that case. The user can select it in // The first layer loaded is not useful in that case. The user can select it in
// the list if he wants to load it. // the list if he wants to load it.
delete layer; delete layer;
layer = NULL; layer = nullptr;
} }
} }
else else
@ -9996,7 +9996,7 @@ QgsRasterLayer* QgisApp::addRasterLayerPrivate(
if ( layer ) if ( layer )
{ {
delete layer; delete layer;
layer = NULL; layer = nullptr;
} }
} }
@ -10149,7 +10149,7 @@ QgsPluginLayer* QgisApp::addPluginLayer( const QString& uri, const QString& base
{ {
QgsPluginLayer* layer = QgsPluginLayerRegistry::instance()->createLayer( providerKey, uri ); QgsPluginLayer* layer = QgsPluginLayerRegistry::instance()->createLayer( providerKey, uri );
if ( !layer ) if ( !layer )
return 0; return nullptr;
layer->setLayerName( baseName ); layer->setLayerName( baseName );

View File

@ -132,7 +132,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
Q_OBJECT Q_OBJECT
public: public:
//! Constructor //! Constructor
QgisApp( QSplashScreen *splash, bool restorePlugins = true, QWidget *parent = 0, Qt::WindowFlags fl = Qt::Window ); QgisApp( QSplashScreen *splash, bool restorePlugins = true, QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::Window );
//! Constructor for unit tests //! Constructor for unit tests
QgisApp(); QgisApp();
//! Destructor //! Destructor
@ -428,7 +428,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QMenu *windowMenu() { return mWindowMenu; } QMenu *windowMenu() { return mWindowMenu; }
#else #else
QMenu *firstRightStandardMenu() { return mHelpMenu; } QMenu *firstRightStandardMenu() { return mHelpMenu; }
QMenu *windowMenu() { return NULL; } QMenu *windowMenu() { return nullptr; }
#endif #endif
QMenu *printComposersMenu() {return mPrintComposersMenu;} QMenu *printComposersMenu() {return mPrintComposersMenu;}
QMenu *helpMenu() { return mHelpMenu; } QMenu *helpMenu() { return mHelpMenu; }
@ -576,19 +576,19 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
\param layerContainingSelection The layer that the selection will be taken from \param layerContainingSelection The layer that the selection will be taken from
(defaults to the active layer on the legend) (defaults to the active layer on the legend)
*/ */
void editCut( QgsMapLayer *layerContainingSelection = 0 ); void editCut( QgsMapLayer *layerContainingSelection = nullptr );
//! copies selected features on the active layer to the clipboard //! copies selected features on the active layer to the clipboard
/** /**
\param layerContainingSelection The layer that the selection will be taken from \param layerContainingSelection The layer that the selection will be taken from
(defaults to the active layer on the legend) (defaults to the active layer on the legend)
*/ */
void editCopy( QgsMapLayer *layerContainingSelection = 0 ); void editCopy( QgsMapLayer *layerContainingSelection = nullptr );
//! copies features on the clipboard to the active layer //! copies features on the clipboard to the active layer
/** /**
\param destinationLayer The layer that the clipboard will be pasted to \param destinationLayer The layer that the clipboard will be pasted to
(defaults to the active layer on the legend) (defaults to the active layer on the legend)
*/ */
void editPaste( QgsMapLayer *destinationLayer = 0 ); void editPaste( QgsMapLayer *destinationLayer = nullptr );
//! copies features on the clipboard to a new vector layer //! copies features on the clipboard to a new vector layer
void pasteAsNewVector(); void pasteAsNewVector();
//! copies features on the clipboard to a new memory vector layer //! copies features on the clipboard to a new memory vector layer
@ -598,13 +598,13 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
\param sourceLayer The layer where the style will be taken from \param sourceLayer The layer where the style will be taken from
(defaults to the active layer on the legend) (defaults to the active layer on the legend)
*/ */
void copyStyle( QgsMapLayer *sourceLayer = 0 ); void copyStyle( QgsMapLayer *sourceLayer = nullptr );
//! pastes style on the clipboard to the active layer //! pastes style on the clipboard to the active layer
/** /**
\param destinationLayer The layer that the clipboard will be pasted to \param destinationLayer The layer that the clipboard will be pasted to
(defaults to the active layer on the legend) (defaults to the active layer on the legend)
*/ */
void pasteStyle( QgsMapLayer *destinationLayer = 0 ); void pasteStyle( QgsMapLayer *destinationLayer = nullptr );
//! copies features to internal clipboard //! copies features to internal clipboard
void copyFeatures( QgsFeatureStore & featureStore ); void copyFeatures( QgsFeatureStore & featureStore );
@ -612,7 +612,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
void loadGDALSublayers( const QString& uri, const QStringList& list ); void loadGDALSublayers( const QString& uri, const QStringList& list );
/** Deletes the selected attributes for the currently selected vector layer*/ /** Deletes the selected attributes for the currently selected vector layer*/
void deleteSelected( QgsMapLayer *layer = 0, QWidget *parent = 0, bool promptConfirmation = false ); void deleteSelected( QgsMapLayer *layer = nullptr, QWidget *parent = nullptr, bool promptConfirmation = false );
//! project was written //! project was written
void writeProject( QDomDocument & ); void writeProject( QDomDocument & );
@ -662,7 +662,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
void updateProjectFromTemplates(); void updateProjectFromTemplates();
//! Opens the options dialog //! Opens the options dialog
void showOptionsDialog( QWidget *parent = 0, const QString& currentPage = QString() ); void showOptionsDialog( QWidget *parent = nullptr, const QString& currentPage = QString() );
/** Refreshes the state of the layer actions toolbar action /** Refreshes the state of the layer actions toolbar action
* @note added in 2.1 */ * @note added in 2.1 */
@ -1354,7 +1354,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
/** Deletes all the composer objects and clears mPrintComposers*/ /** Deletes all the composer objects and clears mPrintComposers*/
void deletePrintComposers(); void deletePrintComposers();
void saveAsVectorFileGeneral( QgsVectorLayer* vlayer = 0, bool symbologyOption = true ); void saveAsVectorFileGeneral( QgsVectorLayer* vlayer = nullptr, bool symbologyOption = true );
/** Paste features from clipboard into a new memory layer. /** Paste features from clipboard into a new memory layer.
* If no features are in clipboard an empty layer is returned. * If no features are in clipboard an empty layer is returned.
@ -1442,52 +1442,52 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
public: public:
Tools() Tools()
: mZoomIn( 0 ) : mZoomIn( nullptr )
, mZoomOut( 0 ) , mZoomOut( nullptr )
, mPan( 0 ) , mPan( nullptr )
#ifdef HAVE_TOUCH #ifdef HAVE_TOUCH
, mTouch( 0 ) , mTouch( 0 )
#endif #endif
, mIdentify( 0 ) , mIdentify( nullptr )
, mFeatureAction( 0 ) , mFeatureAction( nullptr )
, mMeasureDist( 0 ) , mMeasureDist( nullptr )
, mMeasureArea( 0 ) , mMeasureArea( nullptr )
, mMeasureAngle( 0 ) , mMeasureAngle( nullptr )
, mAddFeature( 0 ) , mAddFeature( nullptr )
, mCircularStringCurvePoint( 0 ) , mCircularStringCurvePoint( nullptr )
, mCircularStringRadius( 0 ) , mCircularStringRadius( nullptr )
, mMoveFeature( 0 ) , mMoveFeature( nullptr )
, mOffsetCurve( 0 ) , mOffsetCurve( nullptr )
, mReshapeFeatures( 0 ) , mReshapeFeatures( nullptr )
, mSplitFeatures( 0 ) , mSplitFeatures( nullptr )
, mSplitParts( 0 ) , mSplitParts( nullptr )
, mSelect( 0 ) , mSelect( nullptr )
, mSelectFeatures( 0 ) , mSelectFeatures( nullptr )
, mSelectPolygon( 0 ) , mSelectPolygon( nullptr )
, mSelectFreehand( 0 ) , mSelectFreehand( nullptr )
, mSelectRadius( 0 ) , mSelectRadius( nullptr )
, mVertexAdd( 0 ) , mVertexAdd( nullptr )
, mVertexMove( 0 ) , mVertexMove( nullptr )
, mVertexDelete( 0 ) , mVertexDelete( nullptr )
, mAddRing( 0 ) , mAddRing( nullptr )
, mFillRing( 0 ) , mFillRing( nullptr )
, mAddPart( 0 ) , mAddPart( nullptr )
, mSimplifyFeature( 0 ) , mSimplifyFeature( nullptr )
, mDeleteRing( 0 ) , mDeleteRing( nullptr )
, mDeletePart( 0 ) , mDeletePart( nullptr )
, mNodeTool( 0 ) , mNodeTool( nullptr )
, mRotatePointSymbolsTool( 0 ) , mRotatePointSymbolsTool( nullptr )
, mAnnotation( 0 ) , mAnnotation( nullptr )
, mFormAnnotation( 0 ) , mFormAnnotation( nullptr )
, mHtmlAnnotation( 0 ) , mHtmlAnnotation( nullptr )
, mSvgAnnotation( 0 ) , mSvgAnnotation( nullptr )
, mTextAnnotation( 0 ) , mTextAnnotation( nullptr )
, mPinLabels( 0 ) , mPinLabels( nullptr )
, mShowHideLabels( 0 ) , mShowHideLabels( nullptr )
, mMoveLabel( 0 ) , mMoveLabel( nullptr )
, mRotateFeature( 0 ) , mRotateFeature( nullptr )
, mRotateLabel( 0 ) , mRotateLabel( nullptr )
, mChangeLabelProperties( 0 ) , mChangeLabelProperties( nullptr )
{} {}
QgsMapTool *mZoomIn; QgsMapTool *mZoomIn;

View File

@ -47,7 +47,7 @@
QgisAppInterface::QgisAppInterface( QgisApp * _qgis ) QgisAppInterface::QgisAppInterface( QgisApp * _qgis )
: qgis( _qgis ) : qgis( _qgis )
, mTimer( NULL ) , mTimer( nullptr )
, legendIface( _qgis->layerTreeView() ) , legendIface( _qgis->layerTreeView() )
, pluginManagerIface( _qgis->pluginManager() ) , pluginManagerIface( _qgis->pluginManager() )
{ {
@ -363,18 +363,18 @@ QList<QgsComposerView*> QgisAppInterface::activeComposers()
QgsComposerView* QgisAppInterface::createNewComposer( const QString& title ) QgsComposerView* QgisAppInterface::createNewComposer( const QString& title )
{ {
QgsComposer* composerObj = 0; QgsComposer* composerObj = nullptr;
composerObj = qgis->createNewComposer( title ); composerObj = qgis->createNewComposer( title );
if ( composerObj ) if ( composerObj )
{ {
return composerObj->view(); return composerObj->view();
} }
return 0; return nullptr;
} }
QgsComposerView* QgisAppInterface::duplicateComposer( QgsComposerView* composerView, const QString& title ) QgsComposerView* QgisAppInterface::duplicateComposer( QgsComposerView* composerView, const QString& title )
{ {
QgsComposer* composerObj = 0; QgsComposer* composerObj = nullptr;
composerObj = qobject_cast<QgsComposer *>( composerView->composerWindow() ); composerObj = qobject_cast<QgsComposer *>( composerView->composerWindow() );
if ( composerObj ) if ( composerObj )
{ {
@ -384,14 +384,14 @@ QgsComposerView* QgisAppInterface::duplicateComposer( QgsComposerView* composerV
return dupComposer->view(); return dupComposer->view();
} }
} }
return 0; return nullptr;
} }
void QgisAppInterface::deleteComposer( QgsComposerView* composerView ) void QgisAppInterface::deleteComposer( QgsComposerView* composerView )
{ {
composerView->composerWindow()->close(); composerView->composerWindow()->close();
QgsComposer* composerObj = 0; QgsComposer* composerObj = nullptr;
composerObj = qobject_cast<QgsComposer *>( composerView->composerWindow() ); composerObj = qobject_cast<QgsComposer *>( composerView->composerWindow() );
if ( composerObj ) if ( composerObj )
{ {
@ -452,7 +452,7 @@ QDialog* QgisAppInterface::showAttributeTable( QgsVectorLayer *l, const QString&
dialog->show(); dialog->show();
return dialog; return dialog;
} }
return 0; return nullptr;
} }
void QgisAppInterface::addWindow( QAction *action ) void QgisAppInterface::addWindow( QAction *action )
@ -580,7 +580,7 @@ QAction *QgisAppInterface::actionRollbackAllEdits() { return qgis->actionRollbac
QAction *QgisAppInterface::actionCancelEdits() { return qgis->actionCancelEdits(); } QAction *QgisAppInterface::actionCancelEdits() { return qgis->actionCancelEdits(); }
QAction *QgisAppInterface::actionCancelAllEdits() { return qgis->actionCancelAllEdits(); } QAction *QgisAppInterface::actionCancelAllEdits() { return qgis->actionCancelAllEdits(); }
QAction *QgisAppInterface::actionLayerSaveAs() { return qgis->actionLayerSaveAs(); } QAction *QgisAppInterface::actionLayerSaveAs() { return qgis->actionLayerSaveAs(); }
QAction *QgisAppInterface::actionLayerSelectionSaveAs() { return 0; } QAction *QgisAppInterface::actionLayerSelectionSaveAs() { return nullptr; }
QAction *QgisAppInterface::actionRemoveLayer() { return qgis->actionRemoveLayer(); } QAction *QgisAppInterface::actionRemoveLayer() { return qgis->actionRemoveLayer(); }
QAction *QgisAppInterface::actionDuplicateLayer() { return qgis->actionDuplicateLayer(); } QAction *QgisAppInterface::actionDuplicateLayer() { return qgis->actionDuplicateLayer(); }
QAction *QgisAppInterface::actionLayerProperties() { return qgis->actionLayerProperties(); } QAction *QgisAppInterface::actionLayerProperties() { return qgis->actionLayerProperties(); }
@ -667,7 +667,7 @@ QgsAttributeDialog* QgisAppInterface::getFeatureForm( QgsVectorLayer *l, QgsFeat
QgsAttributeEditorContext context; QgsAttributeEditorContext context;
context.setDistanceArea( myDa ); context.setDistanceArea( myDa );
context.setVectorLayerTools( qgis->vectorLayerTools() ); context.setVectorLayerTools( qgis->vectorLayerTools() );
QgsAttributeDialog *dialog = new QgsAttributeDialog( l, &feature, false, NULL, true, context ); QgsAttributeDialog *dialog = new QgsAttributeDialog( l, &feature, false, nullptr, true, context );
if ( !feature.isValid() ) if ( !feature.isValid() )
{ {
dialog->setIsAddDialog( true ); dialog->setIsAddDialog( true );

View File

@ -30,7 +30,7 @@ class APP_EXPORT QgisAppStyleSheet: public QObject
Q_OBJECT Q_OBJECT
public: public:
QgisAppStyleSheet( QObject * parent = 0 ); QgisAppStyleSheet( QObject * parent = nullptr );
~QgisAppStyleSheet(); ~QgisAppStyleSheet();
/** Return changeable options built from settings and/or defaults */ /** Return changeable options built from settings and/or defaults */

View File

@ -29,9 +29,9 @@ class APP_EXPORT QgsAddAttrDialog: public QDialog, private Ui::QgsAddAttrDialogB
Q_OBJECT Q_OBJECT
public: public:
QgsAddAttrDialog( QgsVectorLayer *vlayer, QgsAddAttrDialog( QgsVectorLayer *vlayer,
QWidget *parent = 0, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); QWidget *parent = nullptr, Qt::WindowFlags fl = QgisGui::ModalDialogFlags );
QgsAddAttrDialog( const std::list<QString>& typelist, QgsAddAttrDialog( const std::list<QString>& typelist,
QWidget *parent = 0, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); QWidget *parent = nullptr, Qt::WindowFlags fl = QgisGui::ModalDialogFlags );
QgsField field() const; QgsField field() const;

View File

@ -33,7 +33,7 @@ class APP_EXPORT QgsAddTabOrGroup : public QDialog, private Ui::QgsAddTabOrGroup
typedef QPair<QString, QTreeWidgetItem*> TabPair; typedef QPair<QString, QTreeWidgetItem*> TabPair;
public: public:
QgsAddTabOrGroup( QgsVectorLayer *lyr, const QList<TabPair>& tabList, QWidget *parent = 0 ); QgsAddTabOrGroup( QgsVectorLayer *lyr, const QList<TabPair>& tabList, QWidget *parent = nullptr );
~QgsAddTabOrGroup(); ~QgsAddTabOrGroup();
QString name(); QString name();

View File

@ -27,7 +27,7 @@ static QgsMapLayer* _rasterLayer( const QString& filename )
if ( layer->type() == QgsMapLayer::RasterLayer && layer->source() == filename ) if ( layer->type() == QgsMapLayer::RasterLayer && layer->source() == filename )
return layer; return layer;
} }
return 0; return nullptr;
} }
static QString _rasterLayerName( const QString& filename ) static QString _rasterLayerName( const QString& filename )

View File

@ -12,7 +12,7 @@ class QgsAlignRasterDialog : public QDialog, private Ui::QgsAlignRasterDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit QgsAlignRasterDialog( QWidget *parent = 0 ); explicit QgsAlignRasterDialog( QWidget *parent = nullptr );
~QgsAlignRasterDialog(); ~QgsAlignRasterDialog();
signals: signals:

View File

@ -24,7 +24,7 @@
#include <QColorDialog> #include <QColorDialog>
QgsAnnotationWidget::QgsAnnotationWidget( QgsAnnotationItem* item, QWidget * parent, Qt::WindowFlags f ): QWidget( parent, f ), mItem( item ), mMarkerSymbol( 0 ) QgsAnnotationWidget::QgsAnnotationWidget( QgsAnnotationItem* item, QWidget * parent, Qt::WindowFlags f ): QWidget( parent, f ), mItem( item ), mMarkerSymbol( nullptr )
{ {
setupUi( this ); setupUi( this );
@ -79,7 +79,7 @@ void QgsAnnotationWidget::apply()
mItem->setFrameColor( mFrameColorButton->color() ); mItem->setFrameColor( mFrameColorButton->color() );
mItem->setFrameBackgroundColor( mBackgroundColorButton->color() ); mItem->setFrameBackgroundColor( mBackgroundColorButton->color() );
mItem->setMarkerSymbol( mMarkerSymbol ); mItem->setMarkerSymbol( mMarkerSymbol );
mMarkerSymbol = 0; //item takes ownership mMarkerSymbol = nullptr; //item takes ownership
mItem->update(); mItem->update();
} }
} }
@ -99,7 +99,7 @@ void QgsAnnotationWidget::on_mMapMarkerButton_clicked()
return; return;
} }
QgsMarkerSymbolV2* markerSymbol = mMarkerSymbol->clone(); QgsMarkerSymbolV2* markerSymbol = mMarkerSymbol->clone();
QgsSymbolV2SelectorDialog dlg( markerSymbol, QgsStyleV2::defaultStyle(), 0, this ); QgsSymbolV2SelectorDialog dlg( markerSymbol, QgsStyleV2::defaultStyle(), nullptr, this );
if ( dlg.exec() == QDialog::Rejected ) if ( dlg.exec() == QDialog::Rejected )
{ {
delete markerSymbol; delete markerSymbol;

View File

@ -29,7 +29,7 @@ class APP_EXPORT QgsAnnotationWidget: public QWidget, private Ui::QgsAnnotationW
{ {
Q_OBJECT Q_OBJECT
public: public:
QgsAnnotationWidget( QgsAnnotationItem* item, QWidget * parent = 0, Qt::WindowFlags f = 0 ); QgsAnnotationWidget( QgsAnnotationItem* item, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr );
~QgsAnnotationWidget(); ~QgsAnnotationWidget();
void apply(); void apply();

View File

@ -357,8 +357,8 @@ void QgsAppLayerTreeViewMenuProvider::addCustomLayerActions( QMenu* menu, QgsMap
// Mac doesn't have '&' keyboard shortcuts. // Mac doesn't have '&' keyboard shortcuts.
menuName.remove( QChar( '&' ) ); menuName.remove( QChar( '&' ) );
#endif #endif
QAction* before = 0; QAction* before = nullptr;
QMenu* newMenu = 0; QMenu* newMenu = nullptr;
QString dst = menuName; QString dst = menuName;
dst.remove( QChar( '&' ) ); dst.remove( QChar( '&' ) );
Q_FOREACH ( QMenu* menu, theMenus ) Q_FOREACH ( QMenu* menu, theMenus )

View File

@ -37,7 +37,7 @@ class APP_EXPORT QgsAttributeActionDialog: public QWidget, private Ui::QgsAttrib
public: public:
QgsAttributeActionDialog( QgsAttributeAction* actions, QgsAttributeActionDialog( QgsAttributeAction* actions,
const QgsFields& fields, const QgsFields& fields,
QWidget* parent = 0 ); QWidget* parent = nullptr );
~QgsAttributeActionDialog() {} ~QgsAttributeActionDialog() {}

View File

@ -64,10 +64,10 @@ static QgsExpressionContext _getExpressionContext( const void* context )
QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWidget *parent, Qt::WindowFlags flags ) QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWidget *parent, Qt::WindowFlags flags )
: QDialog( parent, flags ) : QDialog( parent, flags )
, mDock( 0 ) , mDock( nullptr )
, mLayer( theLayer ) , mLayer( theLayer )
, mRubberBand( 0 ) , mRubberBand( nullptr )
, mCurrentSearchWidgetWrapper( 0 ) , mCurrentSearchWidgetWrapper( nullptr )
{ {
setupUi( this ); setupUi( this );
@ -275,7 +275,7 @@ void QgsAttributeTableDialog::closeEvent( QCloseEvent* event )
{ {
QDialog::closeEvent( event ); QDialog::closeEvent( event );
if ( mDock == NULL ) if ( mDock == nullptr )
{ {
QSettings settings; QSettings settings;
settings.setValue( "/Windows/BetterAttributeTable/geometry", saveGeometry() ); settings.setValue( "/Windows/BetterAttributeTable/geometry", saveGeometry() );
@ -412,7 +412,7 @@ void QgsAttributeTableDialog::runFieldCalculation( QgsVectorLayer* layer, const
if ( !calculationSuccess ) if ( !calculationSuccess )
{ {
QMessageBox::critical( 0, tr( "Error" ), tr( "An error occured while evaluating the calculation string:\n%1" ).arg( error ) ); QMessageBox::critical( nullptr, tr( "Error" ), tr( "An error occured while evaluating the calculation string:\n%1" ).arg( error ) );
mLayer->destroyEditCommand(); mLayer->destroyEditCommand();
return; return;
} }
@ -424,7 +424,7 @@ void QgsAttributeTableDialog::replaceSearchWidget( QWidget* oldw, QWidget* neww
{ {
mFilterLayout->removeWidget( oldw ); mFilterLayout->removeWidget( oldw );
oldw->setVisible( false ); oldw->setVisible( false );
mFilterLayout->addWidget( neww, 0, 0, 0 ); mFilterLayout->addWidget( neww, 0, 0, nullptr );
neww->setVisible( true ); neww->setVisible( true );
} }
@ -434,7 +434,7 @@ void QgsAttributeTableDialog::filterColumnChanged( QObject* filterAction )
mFilterButton->setPopupMode( QToolButton::InstantPopup ); mFilterButton->setPopupMode( QToolButton::InstantPopup );
// replace the search line edit with a search widget that is suited to the selected field // replace the search line edit with a search widget that is suited to the selected field
// delete previous widget // delete previous widget
if ( mCurrentSearchWidgetWrapper != 0 ) if ( mCurrentSearchWidgetWrapper != nullptr )
{ {
mCurrentSearchWidgetWrapper->widget()->setVisible( false ); mCurrentSearchWidgetWrapper->widget()->setVisible( false );
delete mCurrentSearchWidgetWrapper; delete mCurrentSearchWidgetWrapper;
@ -491,7 +491,7 @@ void QgsAttributeTableDialog::filterShowAll()
mFilterButton->setDefaultAction( mActionShowAllFilter ); mFilterButton->setDefaultAction( mActionShowAllFilter );
mFilterButton->setPopupMode( QToolButton::InstantPopup ); mFilterButton->setPopupMode( QToolButton::InstantPopup );
mFilterQuery->setVisible( false ); mFilterQuery->setVisible( false );
if ( mCurrentSearchWidgetWrapper != 0 ) if ( mCurrentSearchWidgetWrapper != nullptr )
{ {
mCurrentSearchWidgetWrapper->widget()->setVisible( false ); mCurrentSearchWidgetWrapper->widget()->setVisible( false );
} }
@ -747,7 +747,7 @@ void QgsAttributeTableDialog::filterQueryChanged( const QString& query )
void QgsAttributeTableDialog::filterQueryAccepted() void QgsAttributeTableDialog::filterQueryAccepted()
{ {
if (( mFilterQuery->isVisible() && mFilterQuery->text().isEmpty() ) || if (( mFilterQuery->isVisible() && mFilterQuery->text().isEmpty() ) ||
( mCurrentSearchWidgetWrapper != 0 && mCurrentSearchWidgetWrapper->widget()->isVisible() ( mCurrentSearchWidgetWrapper != nullptr && mCurrentSearchWidgetWrapper->widget()->isVisible()
&& mCurrentSearchWidgetWrapper->expression().isEmpty() ) ) && mCurrentSearchWidgetWrapper->expression().isEmpty() ) )
{ {
filterShowAll(); filterShowAll();
@ -763,14 +763,14 @@ void QgsAttributeTableDialog::openConditionalStyles()
void QgsAttributeTableDialog::setFilterExpression( const QString& filterString ) void QgsAttributeTableDialog::setFilterExpression( const QString& filterString )
{ {
if ( mCurrentSearchWidgetWrapper == 0 || !mCurrentSearchWidgetWrapper->applyDirectly() ) if ( mCurrentSearchWidgetWrapper == nullptr || !mCurrentSearchWidgetWrapper->applyDirectly() )
{ {
mFilterQuery->setText( filterString ); mFilterQuery->setText( filterString );
mFilterButton->setDefaultAction( mActionAdvancedFilter ); mFilterButton->setDefaultAction( mActionAdvancedFilter );
mFilterButton->setPopupMode( QToolButton::MenuButtonPopup ); mFilterButton->setPopupMode( QToolButton::MenuButtonPopup );
mFilterQuery->setVisible( true ); mFilterQuery->setVisible( true );
mApplyFilterButton->setVisible( true ); mApplyFilterButton->setVisible( true );
if ( mCurrentSearchWidgetWrapper != 0 ) if ( mCurrentSearchWidgetWrapper != nullptr )
{ {
// replace search widget widget with the normal filter query line edit // replace search widget widget with the normal filter query line edit
replaceSearchWidget( mCurrentSearchWidgetWrapper->widget(), mFilterQuery ); replaceSearchWidget( mCurrentSearchWidgetWrapper->widget(), mFilterQuery );

View File

@ -53,7 +53,7 @@ class APP_EXPORT QgsAttributeTableDialog : public QDialog, private Ui::QgsAttrib
* @param parent parent object * @param parent parent object
* @param flags window flags * @param flags window flags
*/ */
QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWidget *parent = 0, Qt::WindowFlags flags = Qt::Window ); QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::Window );
~QgsAttributeTableDialog(); ~QgsAttributeTableDialog();
/** /**
@ -227,7 +227,7 @@ class QgsAttributeTableDock : public QDockWidget
Q_OBJECT Q_OBJECT
public: public:
QgsAttributeTableDock( const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0 ); QgsAttributeTableDock( const QString & title, QWidget * parent = nullptr, Qt::WindowFlags flags = nullptr );
virtual void closeEvent( QCloseEvent * ev ) override; virtual void closeEvent( QCloseEvent * ev ) override;
}; };

View File

@ -27,7 +27,7 @@ class APP_EXPORT QgsBookmarks : public QDockWidget, private Ui::QgsBookmarksBase
Q_OBJECT Q_OBJECT
public: public:
QgsBookmarks( QWidget *parent = 0 ); QgsBookmarks( QWidget *parent = nullptr );
~QgsBookmarks(); ~QgsBookmarks();
public slots: public slots:

View File

@ -76,7 +76,7 @@ void QgsBrowserPropertiesWidget::setWidget( QWidget* paramWidget )
QgsBrowserPropertiesWidget* QgsBrowserPropertiesWidget::createWidget( QgsDataItem* item, QWidget* parent ) QgsBrowserPropertiesWidget* QgsBrowserPropertiesWidget::createWidget( QgsDataItem* item, QWidget* parent )
{ {
QgsBrowserPropertiesWidget* propertiesWidget = 0; QgsBrowserPropertiesWidget* propertiesWidget = nullptr;
// In general, we would like to show all items' paramWidget, but top level items like // In general, we would like to show all items' paramWidget, but top level items like
// WMS etc. have currently too large widgets which do not fit well to browser properties widget // WMS etc. have currently too large widgets which do not fit well to browser properties widget
if ( item->type() == QgsDataItem::Directory ) if ( item->type() == QgsDataItem::Directory )
@ -141,7 +141,7 @@ void QgsBrowserLayerProperties::setItem( QgsDataItem* item )
QgsDebugMsg( "creating raster layer" ); QgsDebugMsg( "creating raster layer" );
// should copy code from addLayer() to split uri ? // should copy code from addLayer() to split uri ?
QgsRasterLayer* layer = new QgsRasterLayer( layerItem->uri(), layerItem->uri(), layerItem->providerKey() ); QgsRasterLayer* layer = new QgsRasterLayer( layerItem->uri(), layerItem->uri(), layerItem->providerKey() );
if ( layer != NULL ) if ( layer != nullptr )
{ {
if ( layer->isValid() ) if ( layer->isValid() )
{ {
@ -155,7 +155,7 @@ void QgsBrowserLayerProperties::setItem( QgsDataItem* item )
{ {
QgsDebugMsg( "creating vector layer" ); QgsDebugMsg( "creating vector layer" );
QgsVectorLayer* layer = new QgsVectorLayer( layerItem->uri(), layerItem->name(), layerItem->providerKey() ); QgsVectorLayer* layer = new QgsVectorLayer( layerItem->uri(), layerItem->name(), layerItem->providerKey() );
if ( layer != NULL ) if ( layer != nullptr )
{ {
if ( layer->isValid() ) if ( layer->isValid() )
{ {
@ -217,7 +217,7 @@ void QgsBrowserLayerProperties::setCondensedMode( bool condensedMode )
QgsBrowserDirectoryProperties::QgsBrowserDirectoryProperties( QWidget* parent ) : QgsBrowserDirectoryProperties::QgsBrowserDirectoryProperties( QWidget* parent ) :
QgsBrowserPropertiesWidget( parent ) QgsBrowserPropertiesWidget( parent )
, mDirectoryWidget( 0 ) , mDirectoryWidget( nullptr )
{ {
setupUi( this ); setupUi( this );
@ -238,7 +238,7 @@ void QgsBrowserDirectoryProperties::setItem( QgsDataItem* item )
QgsBrowserPropertiesDialog::QgsBrowserPropertiesDialog( const QString& settingsSection, QWidget* parent ) : QgsBrowserPropertiesDialog::QgsBrowserPropertiesDialog( const QString& settingsSection, QWidget* parent ) :
QDialog( parent ) QDialog( parent )
, mPropertiesWidget( 0 ) , mPropertiesWidget( nullptr )
, mSettingsSection( settingsSection ) , mSettingsSection( settingsSection )
{ {
setupUi( this ); setupUi( this );
@ -264,8 +264,8 @@ void QgsBrowserPropertiesDialog::setItem( QgsDataItem* item )
QgsBrowserDockWidget::QgsBrowserDockWidget( const QString& name, QWidget * parent ) : QgsBrowserDockWidget::QgsBrowserDockWidget( const QString& name, QWidget * parent ) :
QDockWidget( parent ) QDockWidget( parent )
, mModel( 0 ) , mModel( nullptr )
, mProxyModel( 0 ) , mProxyModel( nullptr )
, mPropertiesWidgetEnabled( false ) , mPropertiesWidgetEnabled( false )
, mPropertiesWidgetHeight( 0 ) , mPropertiesWidgetHeight( 0 )
{ {
@ -511,7 +511,7 @@ void QgsBrowserDockWidget::refreshModel( const QModelIndex& index )
void QgsBrowserDockWidget::addLayer( QgsLayerItem *layerItem ) void QgsBrowserDockWidget::addLayer( QgsLayerItem *layerItem )
{ {
if ( layerItem == NULL ) if ( layerItem == nullptr )
return; return;
QString uri = QgisApp::instance()->crsAndFormatAdjustedLayerUri( layerItem->uri(), layerItem->supportedCRS(), layerItem->supportedFormats() ); QString uri = QgisApp::instance()->crsAndFormatAdjustedLayerUri( layerItem->uri(), layerItem->supportedCRS(), layerItem->supportedFormats() );
@ -541,20 +541,20 @@ void QgsBrowserDockWidget::addLayerAtIndex( const QModelIndex& index )
QgsDebugMsg( QString( "rowCount() = %1" ).arg( mModel->rowCount( mProxyModel->mapToSource( index ) ) ) ); QgsDebugMsg( QString( "rowCount() = %1" ).arg( mModel->rowCount( mProxyModel->mapToSource( index ) ) ) );
QgsDataItem *item = mModel->dataItem( mProxyModel->mapToSource( index ) ); QgsDataItem *item = mModel->dataItem( mProxyModel->mapToSource( index ) );
if ( item != NULL && item->type() == QgsDataItem::Project ) if ( item != nullptr && item->type() == QgsDataItem::Project )
{ {
QgsProjectItem *projectItem = qobject_cast<QgsProjectItem*>( item ); QgsProjectItem *projectItem = qobject_cast<QgsProjectItem*>( item );
if ( projectItem != NULL ) if ( projectItem != nullptr )
{ {
QApplication::setOverrideCursor( Qt::WaitCursor ); QApplication::setOverrideCursor( Qt::WaitCursor );
QgisApp::instance()->openFile( projectItem->path() ); QgisApp::instance()->openFile( projectItem->path() );
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
} }
} }
if ( item != NULL && item->type() == QgsDataItem::Layer ) if ( item != nullptr && item->type() == QgsDataItem::Layer )
{ {
QgsLayerItem *layerItem = qobject_cast<QgsLayerItem*>( item ); QgsLayerItem *layerItem = qobject_cast<QgsLayerItem*>( item );
if ( layerItem != NULL ) if ( layerItem != nullptr )
{ {
QApplication::setOverrideCursor( Qt::WaitCursor ); QApplication::setOverrideCursor( Qt::WaitCursor );
addLayer( layerItem ); addLayer( layerItem );
@ -808,7 +808,7 @@ void QgsDockBrowserTreeView::dragMoveEvent( QDragMoveEvent* e )
// //
QgsBrowserTreeFilterProxyModel::QgsBrowserTreeFilterProxyModel( QObject* parent ) QgsBrowserTreeFilterProxyModel::QgsBrowserTreeFilterProxyModel( QObject* parent )
: QSortFilterProxyModel( parent ), mModel( 0 ) : QSortFilterProxyModel( parent ), mModel( nullptr )
, mFilter( "" ), mPatternSyntax( "normal" ), mCaseSensitivity( Qt::CaseInsensitive ) , mFilter( "" ), mPatternSyntax( "normal" ), mCaseSensitivity( Qt::CaseInsensitive )
{ {
setDynamicSortFilter( true ); setDynamicSortFilter( true );

Some files were not shown because too many files have changed in this diff Show More