diff --git a/src/app/nodetool/qgsmaptoolnodetool.cpp b/src/app/nodetool/qgsmaptoolnodetool.cpp index c1148af1e86..7ad42a6388e 100644 --- a/src/app/nodetool/qgsmaptoolnodetool.cpp +++ b/src/app/nodetool/qgsmaptoolnodetool.cpp @@ -34,7 +34,7 @@ struct QgsExcludePointFilter : public QgsPointLocator::MatchFilter { QgsExcludePointFilter( const QgsPoint& exclPoint ) : mExclPoint( exclPoint ) {} - bool acceptMatch( const QgsPointLocator::Match& match ) { return match.point() != mExclPoint; } + bool acceptMatch( const QgsPointLocator::Match& match ) override { return match.point() != mExclPoint; } QgsPoint mExclPoint; }; @@ -42,7 +42,7 @@ struct QgsExcludePointFilter : public QgsPointLocator::MatchFilter struct QgsFeatureIdFilter : public QgsPointLocator::MatchFilter { QgsFeatureIdFilter( const QgsFeatureId& fid ) : mFid( fid ) {} - bool acceptMatch( const QgsPointLocator::Match& match ) { return match.featureId() == mFid; } + bool acceptMatch( const QgsPointLocator::Match& match ) override { return match.featureId() == mFid; } QgsFeatureId mFid; }; @@ -394,6 +394,7 @@ void QgsMapToolNodeTool::canvasPressEvent( QMouseEvent * e ) QgsVectorLayer *vlayer = mSelectedFeature->vlayer(); Q_ASSERT( vlayer ); + Q_UNUSED( vlayer ); // try to find a piece of currently selected geometry QgsFeatureIdFilter filterFid( mSelectedFeature->featureId() ); diff --git a/src/core/qgspointlocator.cpp b/src/core/qgspointlocator.cpp index b9328c4cb08..c34bc74da28 100644 --- a/src/core/qgspointlocator.cpp +++ b/src/core/qgspointlocator.cpp @@ -62,11 +62,11 @@ class QgsPointLocator_Stream : public IDataStream QgsPointLocator_Stream( const QLinkedList& dataList ) : mDataList( dataList ), mIt( mDataList ) { } ~QgsPointLocator_Stream() { } - virtual IData* getNext() { return mIt.next(); } - virtual bool hasNext() { return mIt.hasNext(); } + virtual IData* getNext() override { return mIt.next(); } + virtual bool hasNext() override { return mIt.hasNext(); } - virtual uint32_t size() { Q_ASSERT( 0 && "not available" ); return 0; } - virtual void rewind() { Q_ASSERT( 0 && "not available" ); } + virtual uint32_t size() override { Q_ASSERT( 0 && "not available" ); return 0; } + virtual void rewind() override { Q_ASSERT( 0 && "not available" ); } private: QLinkedList mDataList; @@ -84,10 +84,10 @@ class QgsPointLocator_VisitorNearestVertex : public IVisitor QgsPointLocator_VisitorNearestVertex( QgsPointLocator* pl, QgsPointLocator::Match& m, const QgsPoint& srcPoint, QgsPointLocator::MatchFilter* filter = 0 ) : mLocator( pl ), mBest( m ), mSrcPoint( srcPoint ), mFilter( filter ) {} - void visitNode( const INode& n ) { Q_UNUSED( n ); } - void visitData( std::vector& v ) { Q_UNUSED( v ); } + void visitNode( const INode& n ) override { Q_UNUSED( n ); } + void visitData( std::vector& v ) override { Q_UNUSED( v ); } - void visitData( const IData& d ) + void visitData( const IData& d ) override { QgsFeatureId id = d.getIdentifier(); QgsGeometry* geom = mLocator->mGeoms.value( id ); @@ -122,10 +122,10 @@ class QgsPointLocator_VisitorNearestEdge : public IVisitor QgsPointLocator_VisitorNearestEdge( QgsPointLocator* pl, QgsPointLocator::Match& m, const QgsPoint& srcPoint, QgsPointLocator::MatchFilter* filter = 0 ) : mLocator( pl ), mBest( m ), mSrcPoint( srcPoint ), mFilter( filter ) {} - void visitNode( const INode& n ) { Q_UNUSED( n ); } - void visitData( std::vector& v ) { Q_UNUSED( v ); } + void visitNode( const INode& n ) override { Q_UNUSED( n ); } + void visitData( std::vector& v ) override { Q_UNUSED( v ); } - void visitData( const IData& d ) + void visitData( const IData& d ) override { QgsFeatureId id = d.getIdentifier(); QgsGeometry* geom = mLocator->mGeoms.value( id ); @@ -168,10 +168,10 @@ class QgsPointLocator_VisitorArea : public IVisitor ~QgsPointLocator_VisitorArea() { delete mGeomPt; } - void visitNode( const INode& n ) { Q_UNUSED( n ); } - void visitData( std::vector& v ) { Q_UNUSED( v ); } + void visitNode( const INode& n ) override { Q_UNUSED( n ); } + void visitData( std::vector& v ) override { Q_UNUSED( v ); } - void visitData( const IData& d ) + void visitData( const IData& d ) override { QgsFeatureId id = d.getIdentifier(); QgsGeometry* g = mLocator->mGeoms.value( id ); @@ -488,10 +488,10 @@ class QgsPointLocator_VisitorEdgesInRect : public IVisitor QgsPointLocator_VisitorEdgesInRect( QgsPointLocator* pl, QgsPointLocator::MatchList& lst, const QgsRectangle& srcRect, QgsPointLocator::MatchFilter* filter = 0 ) : mLocator( pl ), mList( lst ), mSrcRect( srcRect ), mFilter( filter ) {} - void visitNode( const INode& n ) { Q_UNUSED( n ); } - void visitData( std::vector& v ) { Q_UNUSED( v ); } + void visitNode( const INode& n ) override { Q_UNUSED( n ); } + void visitData( std::vector& v ) override { Q_UNUSED( v ); } - void visitData( const IData& d ) + void visitData( const IData& d ) override { QgsFeatureId id = d.getIdentifier(); QgsGeometry* geom = mLocator->mGeoms.value( id ); @@ -526,7 +526,7 @@ class QgsPointLocator_DumpTree : public SpatialIndex::IQueryStrategy public: - void getNextEntry( const IEntry& entry, id_type& nextEntry, bool& hasNext ) + void getNextEntry( const IEntry& entry, id_type& nextEntry, bool& hasNext ) override { const INode* n = dynamic_cast( &entry ); qDebug( "NODE: %ld", n->getIdentifier() ); diff --git a/src/core/qgsvectorlayereditpassthrough.h b/src/core/qgsvectorlayereditpassthrough.h index d295245dd00..6b6e18fd6e0 100644 --- a/src/core/qgsvectorlayereditpassthrough.h +++ b/src/core/qgsvectorlayereditpassthrough.h @@ -24,16 +24,16 @@ class CORE_EXPORT QgsVectorLayerEditPassthrough : public QgsVectorLayerEditBuffe Q_OBJECT public: QgsVectorLayerEditPassthrough( QgsVectorLayer* layer ) { L = layer; } - bool isModified() const { return false; } - bool addFeature( QgsFeature& f ); - bool addFeatures( QgsFeatureList& features ); - bool deleteFeature( QgsFeatureId fid ); - bool changeGeometry( QgsFeatureId fid, QgsGeometry* geom ); - bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() ); - bool addAttribute( const QgsField &field ); - bool deleteAttribute( int attr ); - bool commitChanges( QStringList& commitErrors ); - void rollBack(); + bool isModified() const override { return false; } + bool addFeature( QgsFeature& f ) override; + bool addFeatures( QgsFeatureList& features ) override; + bool deleteFeature( QgsFeatureId fid ) override; + bool changeGeometry( QgsFeatureId fid, QgsGeometry* geom ) override; + bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() ) override; + bool addAttribute( const QgsField &field ) override; + bool deleteAttribute( int attr ) override; + bool commitChanges( QStringList& commitErrors ) override; + void rollBack() override; }; diff --git a/src/gui/qgsbrowsertreeview.cpp b/src/gui/qgsbrowsertreeview.cpp index f460d4f071d..86db5273e56 100644 --- a/src/gui/qgsbrowsertreeview.cpp +++ b/src/gui/qgsbrowsertreeview.cpp @@ -23,7 +23,7 @@ QgsBrowserTreeView::QgsBrowserTreeView( QWidget *parent ) : QTreeView( parent ) - ,mSettingsSection("browser") + , mSettingsSection( "browser" ) { } @@ -42,17 +42,17 @@ void QgsBrowserTreeView::setModel( QAbstractItemModel* model ) void QgsBrowserTreeView::showEvent( QShowEvent * e ) { - Q_UNUSED(e); + Q_UNUSED( e ); QgsDebugMsg( "Entered" ); if ( model() ) restoreState(); - QTreeView::showEvent(e); + QTreeView::showEvent( e ); } // closeEvent is not called when application is closed void QgsBrowserTreeView::hideEvent( QHideEvent * e ) { - Q_UNUSED(e); + Q_UNUSED( e ); QgsDebugMsg( "Entered" ); // hideEvent() may be called (Mac) before showEvent if ( model() ) @@ -74,7 +74,7 @@ void QgsBrowserTreeView::restoreState() QgsDebugMsg( "Entered" ); QSettings settings; mExpandPaths = settings.value( expandedPathsKey(), QVariant() ).toStringList(); - + QgsDebugMsg( "mExpandPaths = " + mExpandPaths.join( " " ) ); if ( !mExpandPaths.isEmpty() ) { @@ -85,20 +85,22 @@ void QgsBrowserTreeView::restoreState() if ( expandIndex.isValid() ) expandIndexSet.insert( expandIndex ); else - QgsDebugMsg( "index for path " + path + " not found"); - } + { + QgsDebugMsg( "index for path " + path + " not found" ); + } + } foreach ( QModelIndex expandIndex, expandIndexSet ) { expandTree( expandIndex ); - } - } + } + } else { // expand root favourites item QModelIndex index = QgsBrowserModel::findPath( model(), "favourites:" ); expand( index ); - } -} + } +} void QgsBrowserTreeView::expandTree( const QModelIndex & index ) { @@ -116,7 +118,7 @@ void QgsBrowserTreeView::expandTree( const QModelIndex & index ) bool QgsBrowserTreeView::treeExpanded( const QModelIndex & index ) { - if( !model() ) + if ( !model() ) return false; if ( !isExpanded( index ) ) return false; @@ -129,7 +131,7 @@ bool QgsBrowserTreeView::treeExpanded( const QModelIndex & index ) bool QgsBrowserTreeView::hasExpandedDescendant( const QModelIndex& index ) const { - if (!model()) + if ( !model() ) return false; for ( int i = 0 ; i < model()->rowCount( index ); i++ ) @@ -145,9 +147,9 @@ bool QgsBrowserTreeView::hasExpandedDescendant( const QModelIndex& index ) const } // rowsInserted signal is used to continue in state restoring -void QgsBrowserTreeView::rowsInserted ( const QModelIndex & parentIndex, int start, int end ) +void QgsBrowserTreeView::rowsInserted( const QModelIndex & parentIndex, int start, int end ) { - QTreeView::rowsInserted ( parentIndex, start, end ); + QTreeView::rowsInserted( parentIndex, start, end ); if ( !model() ) return; @@ -155,7 +157,7 @@ void QgsBrowserTreeView::rowsInserted ( const QModelIndex & parentIndex, int sta if ( mExpandPaths.isEmpty() ) return; - QgsDebugMsgLevel( "mExpandPaths = " + mExpandPaths.join(","), 2 ); + QgsDebugMsgLevel( "mExpandPaths = " + mExpandPaths.join( "," ), 2 ); QString parentPath = model()->data( parentIndex, QgsBrowserModel::PathRole ).toString(); QgsDebugMsgLevel( "parentPath = " + parentPath, 2 ); @@ -179,7 +181,7 @@ void QgsBrowserTreeView::rowsInserted ( const QModelIndex & parentIndex, int sta QModelIndex childIndex = model()->index( i, 0, parentIndex ); QString childPath = model()->data( childIndex, QgsBrowserModel::PathRole ).toString(); - if( mExpandPaths.contains(childPath) || mExpandPaths.indexOf ( QRegExp ( "^" + childPath + "/.*" ) ) != -1 ) + if ( mExpandPaths.contains( childPath ) || mExpandPaths.indexOf( QRegExp( "^" + childPath + "/.*" ) ) != -1 ) { expand( childIndex ); } @@ -194,10 +196,10 @@ QString QgsBrowserTreeView::expandedPathsKey() const QStringList QgsBrowserTreeView::expandedPathsList( const QModelIndex & index ) { QStringList paths; - + if ( !model() ) - return paths; - + return paths; + for ( int i = 0; i < model()->rowCount( index ); i++ ) { QModelIndex childIndex = model()->index( i, 0, index ); @@ -207,12 +209,12 @@ QStringList QgsBrowserTreeView::expandedPathsList( const QModelIndex & index ) if ( !childrenPaths.isEmpty() ) { paths.append( childrenPaths ); - } + } else { paths.append( model()->data( childIndex, QgsBrowserModel::PathRole ).toString() ); - } - } - } + } + } + } return paths; -} +} diff --git a/src/gui/qgsbrowsertreeview.h b/src/gui/qgsbrowsertreeview.h index 91748f6422e..643077acf83 100644 --- a/src/gui/qgsbrowsertreeview.h +++ b/src/gui/qgsbrowsertreeview.h @@ -33,9 +33,9 @@ class GUI_EXPORT QgsBrowserTreeView : public QTreeView QgsBrowserTreeView( QWidget *parent = 0 ); ~QgsBrowserTreeView(); - virtual void setModel( QAbstractItemModel* model ); - virtual void showEvent( QShowEvent * e ); - virtual void hideEvent( QHideEvent * e ); + virtual void setModel( QAbstractItemModel* model ) override; + virtual void showEvent( QShowEvent * e ) override; + virtual void hideEvent( QHideEvent * e ) override; // returns true if at least one descendat is expanded, used in refresh bool hasExpandedDescendant( const QModelIndex& index ) const; @@ -44,8 +44,8 @@ class GUI_EXPORT QgsBrowserTreeView : public QTreeView void setSettingsSection( const QString & section ) { mSettingsSection = section; } protected slots: - virtual void rowsInserted ( const QModelIndex & parentIndex, int start, int end ); - + virtual void rowsInserted( const QModelIndex & parentIndex, int start, int end ) override; + private: QString mSettingsSection; // initial expanded paths diff --git a/src/providers/postgres/qgspostgresprovider.h b/src/providers/postgres/qgspostgresprovider.h index d8887173b1e..d2fb37137d1 100644 --- a/src/providers/postgres/qgspostgresprovider.h +++ b/src/providers/postgres/qgspostgresprovider.h @@ -279,7 +279,7 @@ class QgsPostgresProvider : public QgsVectorDataProvider /** * Returns the transaction this data provider is included in, if any. */ - virtual QgsTransaction* transaction() const; + virtual QgsTransaction* transaction() const override; signals: /** @@ -482,7 +482,7 @@ class QgsPostgresProvider : public QgsVectorDataProvider QgsPostgresTransaction* mTransaction; - void setTransaction( QgsTransaction* transaction ); + void setTransaction( QgsTransaction* transaction ) override; }; diff --git a/src/providers/postgres/qgspostgrestransaction.h b/src/providers/postgres/qgspostgrestransaction.h index 1c89a41c46d..a8a05d24567 100644 --- a/src/providers/postgres/qgspostgrestransaction.h +++ b/src/providers/postgres/qgspostgrestransaction.h @@ -26,15 +26,15 @@ class QgsPostgresTransaction : public QgsTransaction { public: QgsPostgresTransaction( const QString& connString ); - bool executeSql( const QString& sql, QString& error ); + bool executeSql( const QString& sql, QString& error ) override; QgsPostgresConn* connection() const { return mConn; } private: QgsPostgresConn* mConn; - bool beginTransaction( QString& error, int statementTimeout ); - bool commitTransaction( QString& error ); - bool rollbackTransaction( QString& error ); + bool beginTransaction( QString& error, int statementTimeout ) override; + bool commitTransaction( QString& error ) override; + bool rollbackTransaction( QString& error ) override; };