Fix some lint warnings

This commit is contained in:
Nyall Dawson 2018-07-17 11:30:12 +10:00
parent a24c9e1ed0
commit 367ab20cc0
2 changed files with 8 additions and 10 deletions

View File

@ -141,10 +141,10 @@ void QgsStatisticalSummaryDockWidget::copyStatistics()
if ( !rows.isEmpty() )
{
QString text = QString( "%1\t%2\n%3" ).arg( mStatisticsTable->horizontalHeaderItem( 0 )->text(),
QString text = QStringLiteral( "%1\t%2\n%3" ).arg( mStatisticsTable->horizontalHeaderItem( 0 )->text(),
mStatisticsTable->horizontalHeaderItem( 1 )->text(),
rows.join( QStringLiteral( "\n" ) ) );
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 );
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 );
html.replace( QStringLiteral( "\t" ), QStringLiteral( "</td><td>" ) ).replace( QStringLiteral( "\n" ), QStringLiteral( "</td></tr><tr><td>" ) );
QgsClipboard clipboard;
@ -185,7 +185,7 @@ void QgsStatisticalSummaryDockWidget::refreshStatistics()
QgsFeatureIterator fit = QgsVectorLayerUtils::getValuesIterator( mLayer, sourceFieldExp, ok, selectedOnly );
if ( ok )
{
int featureCount = selectedOnly ? mLayer->selectedFeatureCount() : mLayer->featureCount();
long featureCount = selectedOnly ? mLayer->selectedFeatureCount() : mLayer->featureCount();
std::unique_ptr< QgsStatisticsValueGatherer > gatherer = qgis::make_unique< QgsStatisticsValueGatherer >( mLayer, fit, featureCount, sourceFieldExp );
switch ( mFieldType )
{
@ -198,10 +198,12 @@ void QgsStatisticalSummaryDockWidget::refreshStatistics()
case DataType::DateTime:
connect( gatherer.get(), &QgsStatisticsValueGatherer::taskCompleted, this, &QgsStatisticalSummaryDockWidget::updateDateTimeStatistics );
break;
#if 0 // not required for now - we can handle all known types
default:
//don't know how to handle stats for this field!
mStatisticsTable->setRowCount( 0 );
return;
#endif
}
connect( gatherer.get(), &QgsStatisticsValueGatherer::progressChanged, mCalculatingProgressBar, &QProgressBar::setValue );
connect( gatherer.get(), &QgsStatisticsValueGatherer::taskTerminated, this, &QgsStatisticalSummaryDockWidget::gathererFinished );
@ -387,8 +389,6 @@ void QgsStatisticalSummaryDockWidget::statActionTriggered( bool checked )
case DataType::DateTime:
settingsKey = QStringLiteral( "datetime" );
break;
default:
break;
}
QgsSettings settings;
@ -545,8 +545,6 @@ void QgsStatisticalSummaryDockWidget::refreshStatisticsMenu()
}
break;
}
default:
break;
}
}

View File

@ -46,7 +46,7 @@ class QgsStatisticsValueGatherer : public QgsTask
Q_OBJECT
public:
QgsStatisticsValueGatherer( QgsVectorLayer *layer, QgsFeatureIterator fit, int featureCount, QString sourceFieldExp )
QgsStatisticsValueGatherer( QgsVectorLayer *layer, const QgsFeatureIterator &fit, long featureCount, const QString &sourceFieldExp )
: QgsTask( tr( "Fetching statistic values" ) )
, mFeatureIterator( fit )
, mFeatureCount( featureCount )
@ -97,9 +97,9 @@ class QgsStatisticsValueGatherer : public QgsTask
private:
QgsFeatureIterator mFeatureIterator;
int mFeatureCount;
long mFeatureCount = 0;
QString mFieldExpression;
int mFieldIndex;
int mFieldIndex = -1;
QList<QVariant> mValues;
std::unique_ptr<QgsExpression> mExpression;