mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-08 00:05:09 -04:00
Fix clazy unnecessary unnecessary container allocation warnings
This commit is contained in:
parent
ef7e7c5432
commit
252dbdcc48
@ -176,10 +176,10 @@ QVariantMap QgsRasterLayerUniqueValuesReportAlgorithm::processAlgorithm( const Q
|
||||
out << QObject::tr( "<p>%1: %2</p>\n" ).arg( QObject::tr( "NODATA pixel count" ) ).arg( noDataCount );
|
||||
out << QString( "<table><tr><td>%1</td><td>%2</td><td>%3 (%4)</td></tr>\n" ).arg( QObject::tr( "Value" ), QObject::tr( "Pixel count" ), QObject::tr( "Area" ), areaUnit );
|
||||
|
||||
for ( double key : sortedUniqueValues.keys() )
|
||||
for ( auto it = sortedUniqueValues.constBegin(); it != sortedUniqueValues.constEnd(); ++it )
|
||||
{
|
||||
double area = sortedUniqueValues[key] * pixelArea;
|
||||
out << QString( "<tr><td>%1</td><td>%2</td><td>%3</td></tr>\n" ).arg( key ).arg( sortedUniqueValues[key] ).arg( QString::number( area, 'g', 16 ) );
|
||||
double area = it.value() * pixelArea;
|
||||
out << QString( "<tr><td>%1</td><td>%2</td><td>%3</td></tr>\n" ).arg( it.key() ).arg( it.value() ).arg( QString::number( area, 'g', 16 ) );
|
||||
}
|
||||
out << QString( "</table>\n</body></html>" );
|
||||
outputs.insert( QStringLiteral( "OUTPUT_HTML_FILE" ), outputFile );
|
||||
|
@ -739,11 +739,11 @@ void QgsLayoutLegendWidget::mRemoveToolButton_clicked()
|
||||
nodesWithRemoval[nodeLayer].append( _unfilteredLegendNodeIndex( legendNode ) );
|
||||
}
|
||||
}
|
||||
Q_FOREACH ( QgsLayerTreeLayer *nodeLayer, nodesWithRemoval.keys() )
|
||||
for ( auto it = nodesWithRemoval.constBegin(); it != nodesWithRemoval.constEnd(); ++it )
|
||||
{
|
||||
QList<int> toDelete = nodesWithRemoval[nodeLayer];
|
||||
QList<int> toDelete = it.value();
|
||||
std::sort( toDelete.begin(), toDelete.end(), std::greater<int>() );
|
||||
QList<int> order = QgsMapLayerLegendUtils::legendNodeOrder( nodeLayer );
|
||||
QList<int> order = QgsMapLayerLegendUtils::legendNodeOrder( it.key() );
|
||||
|
||||
Q_FOREACH ( int i, toDelete )
|
||||
{
|
||||
@ -751,8 +751,8 @@ void QgsLayoutLegendWidget::mRemoveToolButton_clicked()
|
||||
order.removeAt( i );
|
||||
}
|
||||
|
||||
QgsMapLayerLegendUtils::setLegendNodeOrder( nodeLayer, order );
|
||||
mItemTreeView->layerTreeModel()->refreshLayerLegend( nodeLayer );
|
||||
QgsMapLayerLegendUtils::setLegendNodeOrder( it.key(), order );
|
||||
mItemTreeView->layerTreeModel()->refreshLayerLegend( it.key() );
|
||||
}
|
||||
|
||||
// then remove layer tree nodes
|
||||
|
@ -1655,8 +1655,9 @@ bool QgsCompositionConverter::readOldComposerObjectXml( QgsLayoutObject *layoutI
|
||||
|
||||
void QgsCompositionConverter::readOldDataDefinedPropertyMap( const QDomElement &itemElem, QgsPropertyCollection &dataDefinedProperties )
|
||||
{
|
||||
QgsPropertiesDefinition::const_iterator i = QgsCompositionConverter::propertyDefinitions().constBegin();
|
||||
for ( ; i != QgsCompositionConverter::propertyDefinitions().constEnd(); ++i )
|
||||
const QgsPropertiesDefinition defs = QgsCompositionConverter::propertyDefinitions();
|
||||
QgsPropertiesDefinition::const_iterator i = defs.constBegin();
|
||||
for ( ; i != defs.constEnd(); ++i )
|
||||
{
|
||||
QString elemName = i.value().name();
|
||||
QDomNodeList ddNodeList = itemElem.elementsByTagName( elemName );
|
||||
|
@ -428,11 +428,11 @@ QgsPropertyDefinition QgsAuxiliaryLayer::propertyDefinitionFromField( const QgsF
|
||||
if ( origin.compare( "labeling", Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
const QgsPropertiesDefinition props = QgsPalLayerSettings::propertyDefinitions();
|
||||
for ( const QgsPropertyDefinition &p : props.values() )
|
||||
for ( auto it = props.constBegin(); it != props.constEnd(); ++it )
|
||||
{
|
||||
if ( p.name().compare( propertyName, Qt::CaseInsensitive ) == 0 )
|
||||
if ( it.value().name().compare( propertyName, Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
def = p;
|
||||
def = it.value();
|
||||
if ( parts.size() == 3 )
|
||||
def.setComment( parts[2] );
|
||||
break;
|
||||
@ -442,11 +442,11 @@ QgsPropertyDefinition QgsAuxiliaryLayer::propertyDefinitionFromField( const QgsF
|
||||
else if ( origin.compare( "symbol", Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
const QgsPropertiesDefinition props = QgsSymbolLayer::propertyDefinitions();
|
||||
for ( const QgsPropertyDefinition &p : props.values() )
|
||||
for ( auto it = props.constBegin(); it != props.constEnd(); ++it )
|
||||
{
|
||||
if ( p.name().compare( propertyName, Qt::CaseInsensitive ) == 0 )
|
||||
if ( it.value().name().compare( propertyName, Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
def = p;
|
||||
def = it.value();
|
||||
if ( parts.size() == 3 )
|
||||
def.setComment( parts[2] );
|
||||
break;
|
||||
@ -456,11 +456,11 @@ QgsPropertyDefinition QgsAuxiliaryLayer::propertyDefinitionFromField( const QgsF
|
||||
else if ( origin.compare( "diagram", Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
const QgsPropertiesDefinition props = QgsDiagramLayerSettings::propertyDefinitions();
|
||||
for ( const QgsPropertyDefinition &p : props.values() )
|
||||
for ( auto it = props.constBegin(); it != props.constEnd(); ++it )
|
||||
{
|
||||
if ( p.name().compare( propertyName, Qt::CaseInsensitive ) == 0 )
|
||||
if ( it.value().name().compare( propertyName, Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
def = p;
|
||||
def = it.value();
|
||||
if ( parts.size() == 3 )
|
||||
def.setComment( parts[2] );
|
||||
break;
|
||||
|
@ -2414,12 +2414,13 @@ void QgsProject::setTrustLayerMetadata( bool trust )
|
||||
|
||||
bool QgsProject::saveAuxiliaryStorage( const QString &filename )
|
||||
{
|
||||
for ( QgsMapLayer *l : mapLayers().values() )
|
||||
const QMap<QString, QgsMapLayer *> layers = mapLayers();
|
||||
for ( auto it = layers.constBegin(); it != layers.constEnd(); ++it )
|
||||
{
|
||||
if ( l->type() != QgsMapLayer::VectorLayer )
|
||||
if ( it.value()->type() != QgsMapLayer::VectorLayer )
|
||||
continue;
|
||||
|
||||
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( l );
|
||||
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( it.value() );
|
||||
if ( vl && vl->auxiliaryLayer() )
|
||||
{
|
||||
vl->auxiliaryLayer()->save();
|
||||
|
@ -296,7 +296,7 @@ bool QgsLayoutMouseHandles::selectionRotation( double &rotation ) const
|
||||
double firstItemRotation = ( *itemIter )->rotation();
|
||||
|
||||
//iterate through remaining items, checking if they have same rotation
|
||||
for ( ++itemIter; itemIter != selectedItems.end(); ++itemIter )
|
||||
for ( ++itemIter; itemIter != selectedItems.constEnd(); ++itemIter )
|
||||
{
|
||||
if ( !qgsDoubleNear( ( *itemIter )->rotation(), firstItemRotation ) )
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ void QgsWCSSourceSelect::populateLayerList()
|
||||
lItem->setData( 0, Qt::UserRole + 1, "" );
|
||||
|
||||
// Make only leaves selectable
|
||||
if ( !coverageParents.keys( coverage->orderId ).isEmpty() )
|
||||
if ( coverageParents.contains( coverage->orderId ) )
|
||||
{
|
||||
lItem->setFlags( Qt::ItemIsEnabled );
|
||||
}
|
||||
|
@ -279,9 +279,9 @@ void TestQgsRasterLayer::populateColorRampShader( QgsColorRampShader *colorRampS
|
||||
|
||||
//items to imitate old pseudo color renderer
|
||||
QList<QgsColorRampShader::ColorRampItem> colorRampItems;
|
||||
QList<double>::const_iterator value_it = entryValues.begin();
|
||||
QVector<QColor>::const_iterator color_it = entryColors.begin();
|
||||
for ( ; value_it != entryValues.end(); ++value_it, ++color_it )
|
||||
QList<double>::const_iterator value_it = entryValues.constBegin();
|
||||
QVector<QColor>::const_iterator color_it = entryColors.constBegin();
|
||||
for ( ; value_it != entryValues.constEnd(); ++value_it, ++color_it )
|
||||
{
|
||||
colorRampItems.append( QgsColorRampShader::ColorRampItem( *value_it, *color_it ) );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user