Skip to content

Commit

Permalink
Add missing overrides, fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 28, 2015
1 parent 216821f commit 927a0db
Show file tree
Hide file tree
Showing 15 changed files with 50 additions and 44 deletions.
4 changes: 2 additions & 2 deletions src/app/qgssettingstree.h
Expand Up @@ -55,7 +55,7 @@ class QgsSettingsTree : public QTreeWidget
QgsSettingsTree( QWidget *parent = 0 );

void setSettingsObject( QSettings *settings );
QSize sizeHint() const;
QSize sizeHint() const override;

void setSettingsMap( QMap< QString, QStringList > & map ) { settingsMap = map; }
QString itemKey( QTreeWidgetItem *item );
Expand All @@ -67,7 +67,7 @@ class QgsSettingsTree : public QTreeWidget
void refresh();

protected:
bool event( QEvent *event );
bool event( QEvent *event ) override;

private slots:
void updateSetting( QTreeWidgetItem *item );
Expand Down
8 changes: 4 additions & 4 deletions src/app/qgsvariantdelegate.h
Expand Up @@ -52,12 +52,12 @@ class QgsVariantDelegate : public QItemDelegate
QgsVariantDelegate( QObject* parent = 0 );

void paint( QPainter* painter, const QStyleOptionViewItem& option,
const QModelIndex& index ) const;
const QModelIndex& index ) const override;
QWidget* createEditor( QWidget* parent, const QStyleOptionViewItem& option,
const QModelIndex &index ) const;
void setEditorData( QWidget* editor, const QModelIndex& index ) const;
const QModelIndex &index ) const override;
void setEditorData( QWidget* editor, const QModelIndex& index ) const override;
void setModelData( QWidget* editor, QAbstractItemModel* model,
const QModelIndex &index ) const;
const QModelIndex &index ) const override;

static bool isSupportedType( QVariant::Type type );
static QString displayText( const QVariant& value );
Expand Down
12 changes: 9 additions & 3 deletions src/core/auth/qgsauthmanager.cpp
Expand Up @@ -552,7 +552,9 @@ bool QgsAuthManager::resetMasterPassword( const QString& newpass, const QString
emit messageOut( tr( err ), authManTag(), WARNING );
}
if ( ok )
{
QgsDebugMsg( "Master password reset: cleared current password from database" );
}

// mMasterPass empty, set new password (don't verify, since not stored yet)
setMasterPassword( newpass, false );
Expand All @@ -566,7 +568,9 @@ bool QgsAuthManager::resetMasterPassword( const QString& newpass, const QString
emit messageOut( tr( err ), authManTag(), WARNING );
}
if ( ok )
{
QgsDebugMsg( "Master password reset: stored new password in database" );
}

// verify it stored password properly
if ( ok && !verifyMasterPassword() )
Expand All @@ -586,7 +590,9 @@ bool QgsAuthManager::resetMasterPassword( const QString& newpass, const QString
emit messageOut( tr( err ), authManTag(), WARNING );
}
if ( ok )
{
QgsDebugMsg( "Master password reset: re-encrypted configs in database" );
}

// verify it all worked
if ( ok && !verifyPasswordCanDecryptConfigs() )
Expand Down Expand Up @@ -1296,7 +1302,7 @@ bool QgsAuthManager::updateNetworkRequest( QNetworkRequest &request, const QStri
QgsAuthMethod* authmethod = configAuthMethod( authcfg );
if ( authmethod )
{
if ( !authmethod->supportedExpansions() & QgsAuthMethod::NetworkRequest )
if ( !( authmethod->supportedExpansions() & QgsAuthMethod::NetworkRequest ) )
{
QgsDebugMsg( QString( "Data source URI updating not supported by authcfg: %1" ).arg( authcfg ) );
return false;
Expand All @@ -1322,7 +1328,7 @@ bool QgsAuthManager::updateNetworkReply( QNetworkReply *reply, const QString& au
QgsAuthMethod* authmethod = configAuthMethod( authcfg );
if ( authmethod )
{
if ( !authmethod->supportedExpansions() & QgsAuthMethod::NetworkReply )
if ( !( authmethod->supportedExpansions() & QgsAuthMethod::NetworkReply ) )
{
QgsDebugMsg( QString( "Network reply updating not supported by authcfg: %1" ).arg( authcfg ) );
return false;
Expand All @@ -1348,7 +1354,7 @@ bool QgsAuthManager::updateDataSourceUriItems( QStringList &connectionItems, con
QgsAuthMethod* authmethod = configAuthMethod( authcfg );
if ( authmethod )
{
if ( !authmethod->supportedExpansions() & QgsAuthMethod::DataSourceURI )
if ( !( authmethod->supportedExpansions() & QgsAuthMethod::DataSourceURI ) )
{
QgsDebugMsg( QString( "Data source URI updating not supported by authcfg: %1" ).arg( authcfg ) );
return false;
Expand Down
Expand Up @@ -21,14 +21,14 @@ class QgsGeometryContainedCheckError : public QgsGeometryCheckError
: QgsGeometryCheckError( check, featureId, errorLocation, QgsVertexId(), otherId, ValueOther ), mOtherId( otherId ) { }
const QgsFeatureId& otherId() const { return mOtherId; }

bool isEqual( QgsGeometryCheckError* other ) const
bool isEqual( QgsGeometryCheckError* other ) const override
{
return other->check() == check() &&
other->featureId() == featureId() &&
static_cast<QgsGeometryContainedCheckError*>( other )->otherId() == otherId();
}
}

virtual QString description() const { return QApplication::translate( "QgsGeometryContainedCheckError", "Within %1" ).arg( otherId() ); }
virtual QString description() const override { return QApplication::translate( "QgsGeometryContainedCheckError", "Within %1" ).arg( otherId() ); }

private:
QgsFeatureId mOtherId;
Expand Down
Expand Up @@ -20,13 +20,13 @@ class QgsGeometryDuplicateCheckError : public QgsGeometryCheckError
: QgsGeometryCheckError( check, featureId, errorLocation, QgsVertexId(), duplicatesString( duplicates ) ), mDuplicates( duplicates ) { }
const QList<QgsFeatureId>& duplicates() const { return mDuplicates; }

bool isEqual( QgsGeometryCheckError* other ) const
bool isEqual( QgsGeometryCheckError* other ) const override
{
return other->check() == check() &&
other->featureId() == featureId() &&
// static_cast: since other->checker() == checker is only true if the types are actually the same
static_cast<QgsGeometryDuplicateCheckError*>( other )->duplicates() == duplicates();
}
}

private:
QList<QgsFeatureId> mDuplicates;
Expand Down
16 changes: 8 additions & 8 deletions src/plugins/geometry_checker/checks/qgsgeometrygapcheck.h
Expand Up @@ -30,22 +30,22 @@ class QgsGeometryGapCheckError : public QgsGeometryCheckError
delete mGeometry;
}

QgsAbstractGeometryV2* geometry() { return mGeometry->clone(); }
QgsAbstractGeometryV2* geometry() override { return mGeometry->clone(); }
const QgsFeatureIds& neighbors() const { return mNeighbors; }

bool isEqual( QgsGeometryCheckError* other ) const
bool isEqual( QgsGeometryCheckError* other ) const override
{
QgsGeometryGapCheckError* err = dynamic_cast<QgsGeometryGapCheckError*>( other );
return err && QgsGeomUtils::pointsFuzzyEqual( err->location(), location(), QgsGeometryCheckPrecision::reducedTolerance() ) && err->neighbors() == neighbors();
}
}

bool closeMatch( QgsGeometryCheckError *other ) const
bool closeMatch( QgsGeometryCheckError *other ) const override
{
QgsGeometryGapCheckError* err = dynamic_cast<QgsGeometryGapCheckError*>( other );
return err && err->neighbors() == neighbors();
}
}

void update( const QgsGeometryCheckError* other )
void update( const QgsGeometryCheckError* other ) override
{
QgsGeometryCheckError::update( other );
// Static cast since this should only get called if isEqual == true
Expand All @@ -56,12 +56,12 @@ class QgsGeometryGapCheckError : public QgsGeometryCheckError
mGapAreaBBox = err->mGapAreaBBox;
}

bool handleChanges( const QgsGeometryCheck::Changes& /*changes*/ )
bool handleChanges( const QgsGeometryCheck::Changes& /*changes*/ ) override
{
return true;
}

QgsRectangle affectedAreaBBox() const
QgsRectangle affectedAreaBBox() override
{
return mGapAreaBBox;
}
Expand Down
10 changes: 5 additions & 5 deletions src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.h
Expand Up @@ -21,23 +21,23 @@ class QgsGeometryOverlapCheckError : public QgsGeometryCheckError
: QgsGeometryCheckError( check, featureId, errorLocation, QgsVertexId(), value, ValueArea ), mOtherId( otherId ) { }
const QgsFeatureId& otherId() const { return mOtherId; }

bool isEqual( QgsGeometryCheckError* other ) const
bool isEqual( QgsGeometryCheckError* other ) const override
{
QgsGeometryOverlapCheckError* err = dynamic_cast<QgsGeometryOverlapCheckError*>( other );
return err &&
other->featureId() == featureId() &&
err->otherId() == otherId() &&
QgsGeomUtils::pointsFuzzyEqual( location(), other->location(), QgsGeometryCheckPrecision::reducedTolerance() ) &&
qAbs( value().toDouble() - other->value().toDouble() ) < QgsGeometryCheckPrecision::reducedTolerance();
}
}

bool closeMatch( QgsGeometryCheckError *other ) const
bool closeMatch( QgsGeometryCheckError *other ) const override
{
QgsGeometryOverlapCheckError* err = dynamic_cast<QgsGeometryOverlapCheckError*>( other );
return err && other->featureId() == featureId() && err->otherId() == otherId();
}
}

virtual QString description() const { return QApplication::translate( "QgsGeometryTypeCheckError", "Overlap with %1" ).arg( otherId() ); }
virtual QString description() const override { return QApplication::translate( "QgsGeometryTypeCheckError", "Overlap with %1" ).arg( otherId() ); }

private:
QgsFeatureId mOtherId;
Expand Down
Expand Up @@ -21,8 +21,8 @@ class QgsGeometrySelfIntersectionCheckError : public QgsGeometryCheckError
const QgsGeometryUtils::SelfIntersection& inter )
: QgsGeometryCheckError( check, featureId, errorLocation, vidx ), mInter( inter ) { }
const QgsGeometryUtils::SelfIntersection& intersection() const { return mInter; }
bool isEqual( QgsGeometryCheckError* other ) const;
bool handleChanges( const QgsGeometryCheck::Changes& changes );
bool isEqual( QgsGeometryCheckError* other ) const override;
bool handleChanges( const QgsGeometryCheck::Changes& changes ) override;
void update( const QgsGeometrySelfIntersectionCheckError* other )
{
QgsGeometryCheckError::update( other );
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/geometry_checker/checks/qgsgeometrytypecheck.h
Expand Up @@ -22,13 +22,13 @@ class QgsGeometryTypeCheckError : public QgsGeometryCheckError
mTypeName = QgsWKBTypes::displayString( flatType );
}

bool isEqual( QgsGeometryCheckError* other ) const
bool isEqual( QgsGeometryCheckError* other ) const override
{
return QgsGeometryCheckError::isEqual( other ) &&
mTypeName == static_cast<QgsGeometryTypeCheckError*>( other )->mTypeName;
}
}

virtual QString description() const { return QString( "%1 (%2)" ).arg( mCheck->errorDescription(), mTypeName ); }
virtual QString description() const override { return QString( "%1 (%2)" ).arg( mCheck->errorDescription(), mTypeName ); }

private:
QString mTypeName;
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/geometry_checker/qgsgeometrycheckerplugin.h
Expand Up @@ -29,8 +29,8 @@ class QgsGeometryCheckerPlugin : public QObject, public QgisPlugin
{
public:
QgsGeometryCheckerPlugin( QgisInterface* iface );
void initGui();
void unload();
void initGui() override;
void unload() override;

private:
QgisInterface* mIface;
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/geometry_checker/qgsgeometrycheckfactory.h
Expand Up @@ -30,9 +30,9 @@ class QgsGeometryCheckFactory
template<class T>
class QgsGeometryCheckFactoryT : public QgsGeometryCheckFactory
{
void restorePrevious( Ui::QgsGeometryCheckerSetupTab& /*ui*/ ) const;
bool checkApplicability( Ui::QgsGeometryCheckerSetupTab& ui, QGis::GeometryType geomType ) const;
QgsGeometryCheck* createInstance( QgsFeaturePool* featurePool, const Ui::QgsGeometryCheckerSetupTab& ui, double mapToLayerUnits ) const;
void restorePrevious( Ui::QgsGeometryCheckerSetupTab& /*ui*/ ) const override;
bool checkApplicability( Ui::QgsGeometryCheckerSetupTab& ui, QGis::GeometryType geomType ) const override;
QgsGeometryCheck* createInstance( QgsFeaturePool* featurePool, const Ui::QgsGeometryCheckerSetupTab& ui, double mapToLayerUnits ) const override;
};

class QgsGeometryCheckFactoryRegistry
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/geometry_checker/ui/qgsgeometrycheckerdialog.h
Expand Up @@ -37,8 +37,8 @@ class QgsGeometryCheckerDialog : public QDialog
QDialogButtonBox* mButtonBox;
QTabWidget* mTabWidget;

void done( int r );
void closeEvent( QCloseEvent *ev );
void done( int r ) override;
void closeEvent( QCloseEvent *ev ) override;

private slots:
void onCheckerStarted( QgsGeometryChecker* checker, QgsFeaturePool* featurePool );
Expand Down
Expand Up @@ -50,7 +50,7 @@ class QgsGeometryCheckerFixDialog : public QDialog
QPushButton* mFixBtn;
QPushButton* mSkipBtn;

void showEvent( QShowEvent * );
void showEvent( QShowEvent * ) override;

private slots:
void setupNextError();
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/geometry_snapper/qgsgeometrysnapperplugin.h
Expand Up @@ -35,8 +35,8 @@ class QgsGeometrySnapperPlugin : public QObject, public QgisPlugin
{
public:
QgsGeometrySnapperPlugin( QgisInterface* iface );
void initGui();
void unload();
void initGui() override;
void unload() override;

private:
QgisInterface* mIface;
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/geometry_snapper/qgssnapindex.h
Expand Up @@ -51,15 +51,15 @@ class QgsSnapIndex
{
public:
PointSnapItem( const CoordIdx* _idx );
QgsPointV2 getSnapPoint( const QgsPointV2 &/*p*/ ) const;
QgsPointV2 getSnapPoint( const QgsPointV2 &/*p*/ ) const override;
const CoordIdx* idx;
};

class SegmentSnapItem : public QgsSnapIndex::SnapItem
{
public:
SegmentSnapItem( const CoordIdx* _idxFrom, const CoordIdx* _idxTo );
QgsPointV2 getSnapPoint( const QgsPointV2 &p ) const;
QgsPointV2 getSnapPoint( const QgsPointV2 &p ) const override;
bool getIntersection( const QgsPointV2& p1, const QgsPointV2& p2, QgsPointV2& inter ) const;
bool getProjection( const QgsPointV2 &p, QgsPointV2 &pProj );
const CoordIdx* idxFrom;
Expand Down

0 comments on commit 927a0db

Please sign in to comment.