Skip to content

Commit 98f3c62

Browse files
committed
Fix some lint warnings
(cherry-picked from 367ab20)
1 parent fd8d06d commit 98f3c62

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/app/qgsstatisticalsummarydockwidget.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ void QgsStatisticalSummaryDockWidget::copyStatistics()
141141

142142
if ( !rows.isEmpty() )
143143
{
144-
QString text = QString( "%1\t%2\n%3" ).arg( mStatisticsTable->horizontalHeaderItem( 0 )->text(),
144+
QString text = QStringLiteral( "%1\t%2\n%3" ).arg( mStatisticsTable->horizontalHeaderItem( 0 )->text(),
145145
mStatisticsTable->horizontalHeaderItem( 1 )->text(),
146146
rows.join( QStringLiteral( "\n" ) ) );
147-
QString html = QString( "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"><html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/></head><body><table border=\"1\"><tr><td>%1</td></tr></table></body></html>" ).arg( text );
147+
QString html = QStringLiteral( "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"><html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/></head><body><table border=\"1\"><tr><td>%1</td></tr></table></body></html>" ).arg( text );
148148
html.replace( QStringLiteral( "\t" ), QStringLiteral( "</td><td>" ) ).replace( QStringLiteral( "\n" ), QStringLiteral( "</td></tr><tr><td>" ) );
149149

150150
QgsClipboard clipboard;
@@ -185,7 +185,7 @@ void QgsStatisticalSummaryDockWidget::refreshStatistics()
185185
QgsFeatureIterator fit = QgsVectorLayerUtils::getValuesIterator( mLayer, sourceFieldExp, ok, selectedOnly );
186186
if ( ok )
187187
{
188-
int featureCount = selectedOnly ? mLayer->selectedFeatureCount() : mLayer->featureCount();
188+
long featureCount = selectedOnly ? mLayer->selectedFeatureCount() : mLayer->featureCount();
189189
std::unique_ptr< QgsStatisticsValueGatherer > gatherer = qgis::make_unique< QgsStatisticsValueGatherer >( mLayer, fit, featureCount, sourceFieldExp );
190190
switch ( mFieldType )
191191
{
@@ -198,10 +198,12 @@ void QgsStatisticalSummaryDockWidget::refreshStatistics()
198198
case DataType::DateTime:
199199
connect( gatherer.get(), &QgsStatisticsValueGatherer::taskCompleted, this, &QgsStatisticalSummaryDockWidget::updateDateTimeStatistics );
200200
break;
201+
#if 0 // not required for now - we can handle all known types
201202
default:
202203
//don't know how to handle stats for this field!
203204
mStatisticsTable->setRowCount( 0 );
204205
return;
206+
#endif
205207
}
206208
connect( gatherer.get(), &QgsStatisticsValueGatherer::progressChanged, mCalculatingProgressBar, &QProgressBar::setValue );
207209
connect( gatherer.get(), &QgsStatisticsValueGatherer::taskTerminated, this, &QgsStatisticalSummaryDockWidget::gathererFinished );
@@ -387,8 +389,6 @@ void QgsStatisticalSummaryDockWidget::statActionTriggered( bool checked )
387389
case DataType::DateTime:
388390
settingsKey = QStringLiteral( "datetime" );
389391
break;
390-
default:
391-
break;
392392
}
393393

394394
QgsSettings settings;
@@ -545,8 +545,6 @@ void QgsStatisticalSummaryDockWidget::refreshStatisticsMenu()
545545
}
546546
break;
547547
}
548-
default:
549-
break;
550548
}
551549
}
552550

src/app/qgsstatisticalsummarydockwidget.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class QgsStatisticsValueGatherer : public QgsTask
4646
Q_OBJECT
4747

4848
public:
49-
QgsStatisticsValueGatherer( QgsVectorLayer *layer, QgsFeatureIterator fit, int featureCount, QString sourceFieldExp )
49+
QgsStatisticsValueGatherer( QgsVectorLayer *layer, const QgsFeatureIterator &fit, long featureCount, const QString &sourceFieldExp )
5050
: QgsTask( tr( "Fetching statistic values" ) )
5151
, mFeatureIterator( fit )
5252
, mFeatureCount( featureCount )
@@ -97,9 +97,9 @@ class QgsStatisticsValueGatherer : public QgsTask
9797
private:
9898

9999
QgsFeatureIterator mFeatureIterator;
100-
int mFeatureCount;
100+
long mFeatureCount = 0;
101101
QString mFieldExpression;
102-
int mFieldIndex;
102+
int mFieldIndex = -1;
103103
QList<QVariant> mValues;
104104

105105
std::unique_ptr<QgsExpression> mExpression;

0 commit comments

Comments
 (0)