Skip to content

Commit

Permalink
[Clazy] remove unused-non-trivial-variable
Browse files Browse the repository at this point in the history
  • Loading branch information
troopa81 authored and nyalldawson committed Dec 9, 2022
1 parent a5e14b4 commit 3455982
Show file tree
Hide file tree
Showing 24 changed files with 5 additions and 42 deletions.
4 changes: 0 additions & 4 deletions src/analysis/processing/qgsalgorithmgpsbabeltools.cpp
Expand Up @@ -98,8 +98,6 @@ QgsConvertGpxFeatureTypeAlgorithm *QgsConvertGpxFeatureTypeAlgorithm::createInst

QVariantMap QgsConvertGpxFeatureTypeAlgorithm::processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
{
const QStringList convertStrings;

const QString inputPath = parameterAsString( parameters, QStringLiteral( "INPUT" ), context );
const QString outputPath = parameterAsString( parameters, QStringLiteral( "OUTPUT" ), context );

Expand Down Expand Up @@ -314,8 +312,6 @@ QgsConvertGpsDataAlgorithm *QgsConvertGpsDataAlgorithm::createInstance() const

QVariantMap QgsConvertGpsDataAlgorithm::processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
{
const QStringList convertStrings;

const QString inputPath = parameterAsString( parameters, QStringLiteral( "INPUT" ), context );
const QString outputPath = parameterAsString( parameters, QStringLiteral( "OUTPUT" ), context );

Expand Down
2 changes: 0 additions & 2 deletions src/app/layers/qgsapplayerhandling.cpp
Expand Up @@ -1585,7 +1585,6 @@ void QgsAppLayerHandling::resolveVectorLayerDependencies( QgsVectorLayer *vl, Qg
// where the dependency was actually loaded but it was found as broken
// because the source does not match anymore (for instance when loaded
// from a style definition).
QStringList layerUris;
for ( auto it = QgsProject::instance()->mapLayers().cbegin(); it != QgsProject::instance()->mapLayers().cend(); ++it )
{
if ( it.value()->publicSource() == layerUri )
Expand Down Expand Up @@ -1694,4 +1693,3 @@ void QgsAppLayerHandling::onVectorLayerStyleLoaded( QgsVectorLayer *vl, QgsMapLa
}
}
}

7 changes: 5 additions & 2 deletions src/app/options/qgsoptions.cpp
Expand Up @@ -1292,8 +1292,11 @@ void QgsOptions::checkPageWidgetNameMap()
};
traverseModel( QModelIndex() );

Q_ASSERT_X( pageNames.count() == pageTitles.count(), "QgsOptions::checkPageWidgetNameMap()", QStringLiteral( "QgisApp::optionsPagesMap() is outdated, contains too many entries, "
" this is often a problem with missing translations for the entries (extra entries: %1)" ).arg( qgsSetJoin( QSet( pageNames.keyBegin(), pageNames.keyEnd() ) - pageTitles.toSet(), QStringLiteral( "," ) ) ).toLocal8Bit().constData() );
Q_ASSERT_X( pageNames.count() == pageTitles.count(), "QgsOptions::checkPageWidgetNameMap()",
QStringLiteral( "QgisApp::optionsPagesMap() is outdated, contains too many entries, "
" this is often a problem with missing translations for the entries (extra entries: %1)" ).arg(
qgsSetJoin( QSet( pageNames.keyBegin(), pageNames.keyEnd() ) - QSet( pageTitles.constBegin(), pageTitles.constEnd() ),
QStringLiteral( "," ) ) ).toLocal8Bit().constData() );

int page = 0;
for ( const QString &pageTitle : std::as_const( pageTitles ) )
Expand Down
1 change: 0 additions & 1 deletion src/app/qgsdockablewidgethelper.cpp
Expand Up @@ -89,7 +89,6 @@ void QgsDockableWidgetHelper::writeXml( QDomElement &viewDom )
viewDom.setAttribute( QStringLiteral( "area" ), mDockArea );
viewDom.setAttribute( QStringLiteral( "uuid" ), mUuid );

QStringList tabifiedDocks;
if ( mDock )
{
const QList<QDockWidget * > tabSiblings = mOwnerWindow->tabifiedDockWidgets( mDock );
Expand Down
2 changes: 0 additions & 2 deletions src/core/labeling/qgspallabeling.cpp
Expand Up @@ -1621,8 +1621,6 @@ void QgsPalLayerSettings::calculateLabelSize( const QFontMetricsF *fm, const QSt
double w = 0.0, h = 0.0, rw = 0.0, rh = 0.0;
double labelHeight = fm->ascent() + fm->descent(); // ignore +1 for baseline

QStringList multiLineSplit;

if ( document )
{
document->splitLines( wrapchr, evalAutoWrapLength, useMaxLineLengthForAutoWrap );
Expand Down
2 changes: 0 additions & 2 deletions src/core/metadata/qgslayermetadata.cpp
Expand Up @@ -444,7 +444,6 @@ bool QgsLayerMetadata::contains( const QString &searchString ) const
const QList<QStringList> keyVals { keywords().values() };
for ( const QStringList &kws : std::as_const( keyVals ) )
{
const QStringList constKws { kws };
for ( const QString &kw : std::as_const( kws ) )
{
if ( kw.contains( searchString, Qt::CaseSensitivity::CaseInsensitive ) )
Expand Down Expand Up @@ -480,7 +479,6 @@ bool QgsLayerMetadata::matches( const QVector<QRegularExpression> &searchReList
const QList<QStringList> keyVals { keywords().values() };
for ( const QStringList &kws : std::as_const( keyVals ) )
{
const QStringList constKws { kws };
for ( const QString &kw : std::as_const( kws ) )
{
if ( re.match( kw ).hasMatch() )
Expand Down
1 change: 0 additions & 1 deletion src/core/network/qgsrangerequestcache.cpp
Expand Up @@ -144,7 +144,6 @@ void QgsRangeRequestCache::expire()

QFileInfoList QgsRangeRequestCache::cacheEntries()
{
QStringList list;
QDir dir( mCacheDir );
QFileInfoList filesList = dir.entryInfoList( QDir::Filter::Files, QDir::SortFlags() );
std::sort( filesList.begin(), filesList.end(), []( QFileInfo & f1, QFileInfo & f2 )
Expand Down
2 changes: 0 additions & 2 deletions src/core/processing/qgsprocessingparameters.cpp
Expand Up @@ -1968,7 +1968,6 @@ QStringList QgsProcessingParameters::parameterAsFields( const QgsProcessingParam
if ( !definition )
return QStringList();

const QStringList resultStringList;
return parameterAsFields( definition, parameters.value( definition->name() ), context );
}

Expand Down Expand Up @@ -4335,7 +4334,6 @@ QString QgsProcessingParameterMultipleLayers::asPythonString( const QgsProcessin

QString QgsProcessingParameterMultipleLayers::createFileFilter() const
{
const QStringList exts;
switch ( mLayerType )
{
case QgsProcessing::TypeFile:
Expand Down
1 change: 0 additions & 1 deletion src/core/qgspostgresstringutils.cpp
Expand Up @@ -74,7 +74,6 @@ QVariantList QgsPostgresStringUtils::parseArray( const QString &string )
if ( newVal.trimmed().startsWith( '{' ) )
{
//it's a multidimensional array
QStringList values;
QString subarray = newVal;
while ( !subarray.isEmpty() )
{
Expand Down
2 changes: 0 additions & 2 deletions src/core/symbology/qgsstylemodel.cpp
Expand Up @@ -605,7 +605,6 @@ void QgsStyleModel::setIconGenerator( QgsAbstractStyleEntityIconGenerator *gener
void QgsStyleModel::onEntityAdded( QgsStyle::StyleEntity type, const QString &name )
{
mIconCache[ type ].remove( name );
const QStringList oldSymbolNames = mEntityNames[ type ];
const QStringList newSymbolNames = mStyle->allNames( type );

// find index of newly added symbol
Expand Down Expand Up @@ -1066,4 +1065,3 @@ void QgsStyleProxyModel::setEntityFilters( const QList<QgsStyle::StyleEntity> &f
mEntityFilters = filters;
invalidateFilter();
}

1 change: 0 additions & 1 deletion src/gui/processing/models/qgsmodelinputreorderwidget.cpp
Expand Up @@ -59,7 +59,6 @@ void QgsModelInputReorderWidget::setModel( QgsProcessingModelAlgorithm *model )
{
mModel = model;
mParameters = mModel->orderedParameters();
QStringList res;
mItemModel->clear();
for ( const QgsProcessingModelParameter &param : std::as_const( mParameters ) )
{
Expand Down
1 change: 0 additions & 1 deletion src/gui/processing/qgsprocessingaggregatewidgets.cpp
Expand Up @@ -257,7 +257,6 @@ void QgsAggregateMappingModel::setSourceFields( const QgsFields &sourceFields )
if ( mExpressionContextGenerator )
mExpressionContextGenerator->setSourceFields( mSourceFields );

const QStringList usedFields;
beginResetModel();
mMapping.clear();

Expand Down
Expand Up @@ -332,7 +332,6 @@ void QgsProcessingMultipleInputPanelWidget::addDirectory()
}

QDirIterator it( dir, nameFilters, QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot, QDirIterator::Subdirectories );
QStringList files;
while ( it.hasNext() )
{
const QString fullPath = it.next();
Expand Down
2 changes: 0 additions & 2 deletions src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp
Expand Up @@ -4141,7 +4141,6 @@ void QgsProcessingFieldPanelWidget::setValue( const QVariant &value )
void QgsProcessingFieldPanelWidget::showDialog()
{
QVariantList availableOptions;
QStringList fieldNames;
availableOptions.reserve( mFields.size() );
for ( const QgsField &field : std::as_const( mFields ) )
{
Expand Down Expand Up @@ -6405,7 +6404,6 @@ void QgsProcessingRasterBandPanelWidget::setValue( const QVariant &value )
void QgsProcessingRasterBandPanelWidget::showDialog()
{
QVariantList availableOptions;
QStringList fieldNames;
availableOptions.reserve( mBands.size() );
for ( int band : std::as_const( mBands ) )
{
Expand Down
1 change: 0 additions & 1 deletion src/gui/qgsfindfilesbypatternwidget.cpp
Expand Up @@ -68,7 +68,6 @@ void QgsFindFilesByPatternWidget::find()
filter << pattern;

QDirIterator it( path, filter, QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot, mRecursiveCheckBox->isChecked() ? QDirIterator::Subdirectories : QDirIterator::NoIteratorFlags );
const QStringList files;
while ( it.hasNext() )
{
const QString fullPath = it.next();
Expand Down
3 changes: 0 additions & 3 deletions src/gui/symbology/qgsstylemanagerdialog.cpp
Expand Up @@ -2418,8 +2418,6 @@ void QgsStyleManagerDialog::populateGroups()

void QgsStyleManagerDialog::groupChanged( const QModelIndex &index )
{
QStringList groupSymbols;

const QString category = index.data( Qt::UserRole + 1 ).toString();
sPreviousTag = category;

Expand Down Expand Up @@ -3009,4 +3007,3 @@ void QgsStyleManagerDialog::showHelp()
{
QgsHelp::openHelp( QStringLiteral( "style_library/style_manager.html" ) );
}

2 changes: 0 additions & 2 deletions src/gui/vectortile/qgsvectortilelayerproperties.cpp
Expand Up @@ -214,8 +214,6 @@ void QgsVectorTileLayerProperties::loadStyle()
{
const QgsSettings settings; // where we keep last used filter in persistent state

QStringList ids, names, descriptions;

QgsMapLayerLoadStyleDialog dlg( mLayer );

if ( dlg.exec() )
Expand Down
1 change: 0 additions & 1 deletion src/providers/mdal/qgsmdalprovider.cpp
Expand Up @@ -1147,7 +1147,6 @@ QList<QgsProviderSublayerDetails> QgsMdalProviderMetadata::querySublayers( const
static std::once_flag initialized;
std::call_once( initialized, [ = ]( )
{
QStringList meshExtensions;
QStringList datasetsExtensions;
QgsMdalProvider::fileMeshExtensions( sExtensions, datasetsExtensions );
Q_UNUSED( datasetsExtensions )
Expand Down
2 changes: 0 additions & 2 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -1737,8 +1737,6 @@ bool QgsPostgresProvider::determinePrimaryKey()
res = connectionRO()->LoggedPQexec( "QgsPostgresProvider", sql );
QgsDebugMsgLevel( QStringLiteral( "Got %1 rows." ).arg( res.PQntuples() ), 2 );

QStringList log;

// no primary or unique indices found
if ( res.PQntuples() == 0 )
{
Expand Down
1 change: 0 additions & 1 deletion src/providers/postgres/qgspostgresproviderconnection.cpp
Expand Up @@ -263,7 +263,6 @@ QgsAbstractDatabaseProviderConnection::QueryResult QgsPostgresProviderConnection

QList<QVariantList> QgsPostgresProviderConnection::executeSqlPrivate( const QString &sql, bool resolveTypes, QgsFeedback *feedback, std::shared_ptr<QgsPoolPostgresConn> pgconn ) const
{
QStringList columnNames;
return execSqlPrivate( sql, resolveTypes, feedback, pgconn ).rows();
}

Expand Down
2 changes: 0 additions & 2 deletions src/providers/postgres/raster/qgspostgresrasterprovider.cpp
Expand Up @@ -2089,8 +2089,6 @@ bool QgsPostgresRasterProvider::determinePrimaryKey()
res = connectionRO()->PQexec( sql );
QgsDebugMsgLevel( QStringLiteral( "Got %1 rows." ).arg( res.PQntuples() ), 4 );

QStringList log;

// no primary or unique indices found
if ( res.PQntuples() == 0 )
{
Expand Down
1 change: 0 additions & 1 deletion src/providers/wcs/qgswcsprovider.cpp
Expand Up @@ -1044,7 +1044,6 @@ void QgsWcsProvider::parseServiceException( QDomElement const &e, const QString
}
else
{
const QStringList codes;
seCode = e.attribute( QStringLiteral( "exceptionCode" ) );
// UMN Mapserver (6.0.3) has messed/switched 'locator' and 'exceptionCode'
if ( ! exceptions.contains( seCode ) )
Expand Down
1 change: 0 additions & 1 deletion src/providers/wms/qgswmssourceselect.cpp
Expand Up @@ -1047,7 +1047,6 @@ QString QgsWMSSourceSelect::connName()
void QgsWMSSourceSelect::collectSelectedLayers( QStringList &layers, QStringList &styles, QStringList &titles )
{
//go through list in layer order tab
QStringList selectedLayerList;
for ( int i = mLayerOrderTreeWidget->topLevelItemCount() - 1; i >= 0; --i )
{
layers << mLayerOrderTreeWidget->topLevelItem( i )->text( 0 );
Expand Down
4 changes: 0 additions & 4 deletions tests/src/gui/testqgsrelationreferencewidget.cpp
Expand Up @@ -203,7 +203,6 @@ void TestQgsRelationReferenceWidget::testChainFilter()
}

loop.exec();
QStringList items = getComboBoxItems( w.mComboBox );
QCOMPARE( w.mComboBox->currentText(), allowNull ? QString( "NULL" ) : QString( "10" ) );

// set first filter
Expand Down Expand Up @@ -725,7 +724,6 @@ void TestQgsRelationReferenceWidget::testSetFilterExpression()
w.init();

loop.exec();
QStringList items = getComboBoxItems( w.mComboBox );
QCOMPARE( w.mComboBox->currentText(), QStringLiteral( "NULL" ) );
// in case there is no filter, the number of filtered features will be 4
QCOMPARE( w.mComboBox->count(), 3 );
Expand All @@ -751,8 +749,6 @@ void TestQgsRelationReferenceWidget::testSetFilterExpressionWithOrClause()
w.setFilterExpression( QStringLiteral( " \"raccord\" = 'sleeve' OR FALSE " ) );
w.init();

QStringList items = getComboBoxItems( w.mComboBox );

loop.exec();

// in case there is no filter, the number of filtered features will be 4
Expand Down

0 comments on commit 3455982

Please sign in to comment.