mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
Add overrides pt 5
This commit is contained in:
parent
cfb4b3350a
commit
f0447db733
@ -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() );
|
||||
|
@ -62,11 +62,11 @@ class QgsPointLocator_Stream : public IDataStream
|
||||
QgsPointLocator_Stream( const QLinkedList<RTree::Data*>& 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<RTree::Data*> 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<const IData*>& v ) { Q_UNUSED( v ); }
|
||||
void visitNode( const INode& n ) override { Q_UNUSED( n ); }
|
||||
void visitData( std::vector<const IData*>& 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<const IData*>& v ) { Q_UNUSED( v ); }
|
||||
void visitNode( const INode& n ) override { Q_UNUSED( n ); }
|
||||
void visitData( std::vector<const IData*>& 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<const IData*>& v ) { Q_UNUSED( v ); }
|
||||
void visitNode( const INode& n ) override { Q_UNUSED( n ); }
|
||||
void visitData( std::vector<const IData*>& 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<const IData*>& v ) { Q_UNUSED( v ); }
|
||||
void visitNode( const INode& n ) override { Q_UNUSED( n ); }
|
||||
void visitData( std::vector<const IData*>& 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<const INode*>( &entry );
|
||||
qDebug( "NODE: %ld", n->getIdentifier() );
|
||||
|
@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user