diff --git a/src/analysis/vector/qgsoverlayanalyzer.cpp b/src/analysis/vector/qgsoverlayanalyzer.cpp index d1d7aa81b046..f0bf0ffc528e 100644 --- a/src/analysis/vector/qgsoverlayanalyzer.cpp +++ b/src/analysis/vector/qgsoverlayanalyzer.cpp @@ -192,7 +192,7 @@ void QgsOverlayAnalyzer::combineFieldLists( QgsFields& fieldListA, const QgsFiel for ( int idx = 0; idx < fieldListB.count(); ++idx ) { - QgsField field = fieldListB[idx]; + QgsField field = fieldListB.at( idx ); int count = 0; while ( names.contains( field.name() ) ) { diff --git a/src/app/qgsdelattrdialog.cpp b/src/app/qgsdelattrdialog.cpp index bd69981c74ab..82b021539b3c 100644 --- a/src/app/qgsdelattrdialog.cpp +++ b/src/app/qgsdelattrdialog.cpp @@ -34,7 +34,7 @@ QgsDelAttrDialog::QgsDelAttrDialog( const QgsVectorLayer* vl ) const QgsFields& layerAttributes = vl->fields(); for ( int idx = 0; idx < layerAttributes.count(); ++idx ) { - QListWidgetItem* item = new QListWidgetItem( layerAttributes[idx].name(), listBox2 ); + QListWidgetItem* item = new QListWidgetItem( layerAttributes.at( idx ).name(), listBox2 ); switch ( vl->fields().fieldOrigin( idx ) ) { case QgsFields::OriginExpression: diff --git a/src/app/qgsdiagramproperties.cpp b/src/app/qgsdiagramproperties.cpp index 08b90111c49b..a090844c449f 100644 --- a/src/app/qgsdiagramproperties.cpp +++ b/src/app/qgsdiagramproperties.cpp @@ -184,14 +184,14 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, for ( int idx = 0; idx < layerFields.count(); ++idx ) { QTreeWidgetItem *newItem = new QTreeWidgetItem( mAttributesTreeWidget ); - QString name = QString( "\"%1\"" ).arg( layerFields[idx].name() ); + QString name = QString( "\"%1\"" ).arg( layerFields.at( idx ).name() ); newItem->setText( 0, name ); newItem->setData( 0, Qt::UserRole, name ); newItem->setFlags( newItem->flags() & ~Qt::ItemIsDropEnabled ); - mDataDefinedXComboBox->addItem( layerFields[idx].name(), idx ); - mDataDefinedYComboBox->addItem( layerFields[idx].name(), idx ); - mDataDefinedVisibilityComboBox->addItem( layerFields[idx].name(), idx ); + mDataDefinedXComboBox->addItem( layerFields.at( idx ).name(), idx ); + mDataDefinedYComboBox->addItem( layerFields.at( idx ).name(), idx ); + mDataDefinedVisibilityComboBox->addItem( layerFields.at( idx ).name(), idx ); } const QgsDiagramRendererV2* dr = layer->diagramRenderer(); diff --git a/src/app/qgsfieldcalculator.cpp b/src/app/qgsfieldcalculator.cpp index e0dd0980455e..43058e5f79ea 100644 --- a/src/app/qgsfieldcalculator.cpp +++ b/src/app/qgsfieldcalculator.cpp @@ -234,7 +234,7 @@ void QgsFieldCalculator::accept() for ( int idx = 0; idx < fields.count(); ++idx ) { - if ( fields[idx].name() == mOutputFieldNameLineEdit->text() ) + if ( fields.at( idx ).name() == mOutputFieldNameLineEdit->text() ) { mAttributeId = idx; break; diff --git a/src/app/qgsfieldsproperties.cpp b/src/app/qgsfieldsproperties.cpp index cf8e843819d8..db9d70bf92b5 100644 --- a/src/app/qgsfieldsproperties.cpp +++ b/src/app/qgsfieldsproperties.cpp @@ -576,7 +576,7 @@ void QgsFieldsProperties::attributeAdded( int idx ) const QgsFields &fields = mLayer->fields(); int row = mFieldsList->rowCount(); mFieldsList->insertRow( row ); - setRow( row, idx, fields[idx] ); + setRow( row, idx, fields.at( idx ) ); mFieldsList->setCurrentCell( row, idx ); for ( int i = idx + 1; i < mIndexedWidgets.count(); i++ ) diff --git a/src/app/qgsidentifyresultsdialog.cpp b/src/app/qgsidentifyresultsdialog.cpp index 6cfdbef5d96a..906ed9f2fc03 100644 --- a/src/app/qgsidentifyresultsdialog.cpp +++ b/src/app/qgsidentifyresultsdialog.cpp @@ -493,7 +493,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeat featItem->addChild( attrItem ); attrItem->setData( 0, Qt::DisplayRole, vlayer->attributeDisplayName( i ) ); - attrItem->setData( 0, Qt::UserRole, fields[i].name() ); + attrItem->setData( 0, Qt::UserRole, fields.at( i ).name() ); attrItem->setData( 0, Qt::UserRole + 1, i ); attrItem->setData( 1, Qt::UserRole, value ); @@ -515,7 +515,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeat attrItem->treeWidget()->setItemWidget( attrItem, 1, nullptr ); } - if ( fields[i].name() == vlayer->displayField() ) + if ( fields.at( i ).name() == vlayer->displayField() ) { featItem->setText( 0, attrItem->text( 0 ) ); featItem->setText( 1, attrItem->text( 1 ) ); @@ -560,11 +560,11 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeat tblResults->setItem( j, 1, item ); item = new QTableWidgetItem( QString::number( i ) ); - if ( fields[i].name() == vlayer->displayField() ) + if ( fields.at( i ).name() == vlayer->displayField() ) item->setData( Qt::DisplayRole, vlayer->attributeDisplayName( i ) + " *" ); else item->setData( Qt::DisplayRole, vlayer->attributeDisplayName( i ) ); - item->setData( Qt::UserRole, fields[i].name() ); + item->setData( Qt::UserRole, fields.at( i ).name() ); item->setData( Qt::UserRole + 1, i ); tblResults->setItem( j, 2, item ); @@ -765,7 +765,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer, QTreeWidgetItem *attrItem = new QTreeWidgetItem( QStringList() << QString::number( i ) << attrs.at( i ).toString() ); - attrItem->setData( 0, Qt::DisplayRole, fields[i].name() ); + attrItem->setData( 0, Qt::DisplayRole, fields.at( i ).name() ); QVariant value = attrs.at( i ); attrItem->setData( 1, Qt::DisplayRole, value ); @@ -1188,7 +1188,7 @@ void QgsIdentifyResultsDialog::doAction( QTreeWidgetItem *item, int action ) const QgsFields& fields = layer->fields(); for ( int fldIdx = 0; fldIdx < fields.count(); ++fldIdx ) { - if ( fields[fldIdx].name() == fieldName ) + if ( fields.at( fldIdx ).name() == fieldName ) { idx = fldIdx; break; @@ -1741,7 +1741,7 @@ void QgsIdentifyResultsDialog::copyFeatureAttributes() if ( attrIdx < 0 || attrIdx >= fields.count() ) continue; - text += QString( "%1: %2\n" ).arg( fields[attrIdx].name(), it.value().toString() ); + text += QString( "%1: %2\n" ).arg( fields.at( attrIdx ).name(), it.value().toString() ); } } else if ( rlayer ) diff --git a/src/app/qgslabelpropertydialog.cpp b/src/app/qgslabelpropertydialog.cpp index 99bd858de980..a57ca2be05b0 100644 --- a/src/app/qgslabelpropertydialog.cpp +++ b/src/app/qgslabelpropertydialog.cpp @@ -103,7 +103,7 @@ void QgsLabelPropertyDialog::init( const QString& layerId, const QString& provid { mLabelTextLineEdit->setText( attributeValues.at( mCurLabelField ).toString() ); const QgsFields& layerFields = vlayer->fields(); - switch ( layerFields[mCurLabelField].type() ) + switch ( layerFields.at( mCurLabelField ).type() ) { case QVariant::Double: mLabelTextLineEdit->setValidator( new QDoubleValidator( this ) ); diff --git a/src/app/qgsmergeattributesdialog.cpp b/src/app/qgsmergeattributesdialog.cpp index 2e4ef7dbcdae..84e4a20b861c 100644 --- a/src/app/qgsmergeattributesdialog.cpp +++ b/src/app/qgsmergeattributesdialog.cpp @@ -358,7 +358,7 @@ QVariant QgsMergeAttributesDialog::calcStatistic( int col, QgsStatisticalSummary if ( values.isEmpty() ) { - return QVariant( mVectorLayer->fields()[col].type() ); + return QVariant( mVectorLayer->fields().at( col ).type() ); } summary.calculate( values ); diff --git a/src/core/composer/qgscomposerattributetable.cpp b/src/core/composer/qgscomposerattributetable.cpp index 17042e982881..b27b8d56f115 100644 --- a/src/core/composer/qgscomposerattributetable.cpp +++ b/src/core/composer/qgscomposerattributetable.cpp @@ -241,7 +241,7 @@ void QgsComposerAttributeTable::setDisplayAttributes( const QSet& attr, boo } QString currentAlias = mVectorLayer->attributeDisplayName( attrIdx ); QgsComposerTableColumn* col = new QgsComposerTableColumn; - col->setAttribute( fields[attrIdx].name() ); + col->setAttribute( fields.at( attrIdx ).name() ); col->setHeading( currentAlias ); mColumns.append( col ); } @@ -652,7 +652,7 @@ bool QgsComposerAttributeTable::readXml( const QDomElement& itemElem, const QDom //find corresponding column Q_FOREACH ( QgsComposerTableColumn* column, mColumns ) { - if ( column->attribute() == fields[attribute].name() ) + if ( column->attribute() == fields.at( attribute ).name() ) { column->setSortByRank( i + 1 ); column->setSortOrder( order ); diff --git a/src/core/composer/qgscomposerattributetablev2.cpp b/src/core/composer/qgscomposerattributetablev2.cpp index a52f05a7586d..8c2c2c3627e8 100644 --- a/src/core/composer/qgscomposerattributetablev2.cpp +++ b/src/core/composer/qgscomposerattributetablev2.cpp @@ -338,7 +338,7 @@ void QgsComposerAttributeTableV2::setDisplayAttributes( const QSet& attr, b } QString currentAlias = source->attributeDisplayName( attrIdx ); QgsComposerTableColumn* col = new QgsComposerTableColumn; - col->setAttribute( fields[attrIdx].name() ); + col->setAttribute( fields.at( attrIdx ).name() ); col->setHeading( currentAlias ); mColumns.append( col ); } diff --git a/src/core/qgsactionmanager.cpp b/src/core/qgsactionmanager.cpp index 177693fc0ecc..b8764e43c333 100644 --- a/src/core/qgsactionmanager.cpp +++ b/src/core/qgsactionmanager.cpp @@ -210,13 +210,13 @@ QString QgsActionManager::expandAction( QString action, const QgsAttributeMap &a switch ( i ) { case 0: - to_replace = "[%" + fields[attrIdx].name() + ']'; + to_replace = "[%" + fields.at( attrIdx ).name() + ']'; break; case 1: to_replace = "[%" + mLayer->attributeDisplayName( attrIdx ) + ']'; break; case 2: - to_replace = '%' + fields[attrIdx].name(); + to_replace = '%' + fields.at( attrIdx ).name(); break; case 3: to_replace = '%' + mLayer->attributeDisplayName( attrIdx ); diff --git a/src/core/qgsgml.cpp b/src/core/qgsgml.cpp index f7a2f3e07911..d159d11df0bd 100644 --- a/src/core/qgsgml.cpp +++ b/src/core/qgsgml.cpp @@ -294,7 +294,7 @@ QgsGmlStreamingParser::QgsGmlStreamingParser( const QString& typeName, mThematicAttributes.clear(); for ( int i = 0; i < fields.size(); i++ ) { - mThematicAttributes.insert( fields[i].name(), qMakePair( i, fields[i] ) ); + mThematicAttributes.insert( fields.at( i ).name(), qMakePair( i, fields.at( i ) ) ); } mEndian = QgsApplication::endian(); @@ -355,13 +355,13 @@ QgsGmlStreamingParser::QgsGmlStreamingParser( const QList& laye mThematicAttributes.clear(); for ( int i = 0; i < fields.size(); i++ ) { - QMap< QString, QPair >::const_iterator att_it = mapFieldNameToSrcLayerNameFieldName.constFind( fields[i].name() ); + QMap< QString, QPair >::const_iterator att_it = mapFieldNameToSrcLayerNameFieldName.constFind( fields.at( i ).name() ); if ( att_it != mapFieldNameToSrcLayerNameFieldName.constEnd() ) { if ( mLayerProperties.size() == 1 ) - mThematicAttributes.insert( att_it.value().second, qMakePair( i, fields[i] ) ); + mThematicAttributes.insert( att_it.value().second, qMakePair( i, fields.at( i ) ) ); else - mThematicAttributes.insert( stripNS( att_it.value().first ) + "|" + att_it.value().second, qMakePair( i, fields[i] ) ); + mThematicAttributes.insert( stripNS( att_it.value().first ) + "|" + att_it.value().second, qMakePair( i, fields.at( i ) ) ); } } bool alreadyFoundGeometry = false; diff --git a/src/core/qgsvectorfilewriter.cpp b/src/core/qgsvectorfilewriter.cpp index 2766d1136a4f..7aeaf97bf5d4 100644 --- a/src/core/qgsvectorfilewriter.cpp +++ b/src/core/qgsvectorfilewriter.cpp @@ -398,13 +398,13 @@ void QgsVectorFileWriter::init( QString vectorFileName, for ( int fldIdx = 0; fldIdx < fields.count(); ++fldIdx ) { - QgsField attrField = fields[fldIdx]; + QgsField attrField = fields.at( fldIdx ); OGRFieldType ogrType = OFTString; //default to string if ( fieldValueConverter ) { - attrField = fieldValueConverter->fieldDefinition( fields[fldIdx] ); + attrField = fieldValueConverter->fieldDefinition( fields.at( fldIdx ) ); } int ogrWidth = attrField.length(); @@ -489,7 +489,7 @@ void QgsVectorFileWriter::init( QString vectorFileName, name = QString( "ogc_fid%1" ).arg( i ); int j; - for ( j = 0; j < fields.size() && name.compare( fields[j].name(), Qt::CaseInsensitive ) != 0; j++ ) + for ( j = 0; j < fields.size() && name.compare( fields.at( j ).name(), Qt::CaseInsensitive ) != 0; j++ ) ; if ( j == fields.size() ) diff --git a/src/gui/qgsquerybuilder.cpp b/src/gui/qgsquerybuilder.cpp index ea7cd846b409..b211face3510 100644 --- a/src/gui/qgsquerybuilder.cpp +++ b/src/gui/qgsquerybuilder.cpp @@ -77,7 +77,7 @@ void QgsQueryBuilder::populateFields() // only consider native fields continue; } - QStandardItem *myItem = new QStandardItem( fields[idx].name() ); + QStandardItem *myItem = new QStandardItem( fields.at( idx ).name() ); myItem->setData( idx ); myItem->setEditable( false ); mModelFields->insertRow( mModelFields->rowCount(), myItem ); diff --git a/src/gui/qgssearchquerybuilder.cpp b/src/gui/qgssearchquerybuilder.cpp index 998aa959f342..be13a86cdb66 100644 --- a/src/gui/qgssearchquerybuilder.cpp +++ b/src/gui/qgssearchquerybuilder.cpp @@ -77,7 +77,7 @@ void QgsSearchQueryBuilder::populateFields() const QgsFields& fields = mLayer->fields(); for ( int idx = 0; idx < fields.count(); ++idx ) { - QString fieldName = fields[idx].name(); + QString fieldName = fields.at( idx ).name(); mFieldMap[fieldName] = idx; QStandardItem *myItem = new QStandardItem( fieldName ); myItem->setEditable( false ); diff --git a/src/providers/db2/qgsdb2provider.cpp b/src/providers/db2/qgsdb2provider.cpp index e551ce07c4b6..cc370e166410 100644 --- a/src/providers/db2/qgsdb2provider.cpp +++ b/src/providers/db2/qgsdb2provider.cpp @@ -1332,7 +1332,7 @@ QgsVectorLayerImport::ImportError QgsDb2Provider::createEmptyLayer( const QStrin QString pk = primaryKey = "QGS_FID"; for ( int i = 0; i < fieldCount; ++i ) { - if ( fields[i].name() == primaryKey ) + if ( fields.at( i ).name() == primaryKey ) { // it already exists, try again with a new name primaryKey = QString( "%1_%2" ).arg( pk ).arg( index++ ); @@ -1345,10 +1345,10 @@ QgsVectorLayerImport::ImportError QgsDb2Provider::createEmptyLayer( const QStrin // search for the passed field for ( int i = 0; i < fieldCount; ++i ) { - if ( fields[i].name() == primaryKey ) + if ( fields.at( i ).name() == primaryKey ) { // found, get the field type - QgsField fld = fields[i]; + QgsField fld = fields.at( i ); if ( convertField( fld ) ) { primaryKeyType = fld.typeName(); diff --git a/src/providers/memory/qgsmemoryprovider.cpp b/src/providers/memory/qgsmemoryprovider.cpp index 8047c6618356..d68166069712 100644 --- a/src/providers/memory/qgsmemoryprovider.cpp +++ b/src/providers/memory/qgsmemoryprovider.cpp @@ -262,7 +262,7 @@ QString QgsMemoryProvider::dataSourceUri( bool expandAuthConfig ) const QgsAttributeList attrs = const_cast( this )->attributeIndexes(); for ( int i = 0; i < attrs.size(); i++ ) { - QgsField field = mFields[attrs[i]]; + QgsField field = mFields.at( attrs[i] ); QString fieldDef = field.name(); fieldDef.append( QString( ":%2(%3,%4)" ).arg( field.typeName() ).arg( field.length() ).arg( field.precision() ) ); uri.addQueryItem( "field", fieldDef ); diff --git a/src/providers/mssql/qgsmssqlprovider.cpp b/src/providers/mssql/qgsmssqlprovider.cpp index 450785e505fc..3b28d0ff8b20 100644 --- a/src/providers/mssql/qgsmssqlprovider.cpp +++ b/src/providers/mssql/qgsmssqlprovider.cpp @@ -1669,7 +1669,7 @@ QgsVectorLayerImport::ImportError QgsMssqlProvider::createEmptyLayer( const QStr QString pk = primaryKey = "qgs_fid"; for ( int i = 0, n = fields.size(); i < n; ++i ) { - if ( fields[i].name() == primaryKey ) + if ( fields.at( i ).name() == primaryKey ) { // it already exists, try again with a new name primaryKey = QString( "%1_%2" ).arg( pk ).arg( index++ ); @@ -1682,10 +1682,10 @@ QgsVectorLayerImport::ImportError QgsMssqlProvider::createEmptyLayer( const QStr // search for the passed field for ( int i = 0, n = fields.size(); i < n; ++i ) { - if ( fields[i].name() == primaryKey ) + if ( fields.at( i ).name() == primaryKey ) { // found, get the field type - QgsField fld = fields[i]; + QgsField fld = fields.at( i ); if ( convertField( fld ) ) { primaryKeyType = fld.typeName(); @@ -1830,7 +1830,7 @@ QgsVectorLayerImport::ImportError QgsMssqlProvider::createEmptyLayer( const QStr QList flist; for ( int i = 0, n = fields.size(); i < n; ++i ) { - QgsField fld = fields[i]; + QgsField fld = fields.at( i ); if ( oldToNewAttrIdxMap && fld.name() == primaryKey ) { oldToNewAttrIdxMap->insert( fields.fieldNameIndex( fld.name() ), 0 ); diff --git a/src/providers/oracle/qgsoraclefeatureiterator.cpp b/src/providers/oracle/qgsoraclefeatureiterator.cpp index ee9eab0607fb..a8db8272055f 100644 --- a/src/providers/oracle/qgsoraclefeatureiterator.cpp +++ b/src/providers/oracle/qgsoraclefeatureiterator.cpp @@ -452,14 +452,14 @@ bool QgsOracleFeatureIterator::openQuery( QString whereClause, bool showLog ) break; case pktInt: - query += delim + QgsOracleProvider::quotedIdentifier( mSource->mFields[ mSource->mPrimaryKeyAttrs[0] ].name() ); + query += delim + QgsOracleProvider::quotedIdentifier( mSource->mFields.at( mSource->mPrimaryKeyAttrs[0] ).name() ); delim = ","; break; case pktFidMap: Q_FOREACH ( int idx, mSource->mPrimaryKeyAttrs ) { - query += delim + mConnection->fieldExpression( mSource->mFields[idx] ); + query += delim + mConnection->fieldExpression( mSource->mFields.at( idx ) ); delim = ","; } break; @@ -475,7 +475,7 @@ bool QgsOracleFeatureIterator::openQuery( QString whereClause, bool showLog ) if ( mSource->mPrimaryKeyAttrs.contains( idx ) ) continue; - query += delim + mConnection->fieldExpression( mSource->mFields[idx] ); + query += delim + mConnection->fieldExpression( mSource->mFields.at( idx ) ); } query += QString( " FROM %1 \"FEATUREREQUEST\"" ).arg( mSource->mQuery ); diff --git a/src/providers/oracle/qgsoracleprovider.cpp b/src/providers/oracle/qgsoracleprovider.cpp index bd92d3438163..6fb54f00e61b 100644 --- a/src/providers/oracle/qgsoracleprovider.cpp +++ b/src/providers/oracle/qgsoracleprovider.cpp @@ -181,7 +181,7 @@ QgsOracleProvider::QgsOracleProvider( QString const & uri ) Q_FOREACH ( int idx, mPrimaryKeyAttrs ) { Q_ASSERT( idx >= 0 && idx < mAttributeFields.size() ); - key += delim + mAttributeFields[ idx ].name(); + key += delim + mAttributeFields.at( idx ).name(); delim = ","; } } @@ -416,7 +416,7 @@ QString QgsOracleUtils::whereClause( QgsFeatureId featureId, const QgsFields& fi { case pktInt: Q_ASSERT( primaryKeyAttrs.size() == 1 ); - whereClause = QString( "%1=%2" ).arg( QgsOracleConn::quotedIdentifier( fields[ primaryKeyAttrs[0] ].name() ) ).arg( featureId ); + whereClause = QString( "%1=%2" ).arg( QgsOracleConn::quotedIdentifier( fields.at( primaryKeyAttrs[0] ).name() ) ).arg( featureId ); break; case pktRowId: @@ -966,9 +966,9 @@ bool QgsOracleProvider::determinePrimaryKey() int idx = fieldNameIndex( mUri.keyColumn() ); if ( idx >= 0 && ( - mAttributeFields[idx].type() == QVariant::Int || - mAttributeFields[idx].type() == QVariant::LongLong || - mAttributeFields[idx].type() == QVariant::Double + mAttributeFields.at( idx ).type() == QVariant::Int || + mAttributeFields.at( idx ).type() == QVariant::LongLong || + mAttributeFields.at( idx ).type() == QVariant::Double ) ) { if ( mUseEstimatedMetadata || uniqueData( mQuery, primaryKey ) ) @@ -1299,7 +1299,7 @@ bool QgsOracleProvider::addFeatures( QgsFeatureList &flist ) } else { - values += delim + quotedValue( v, mAttributeFields[idx].type() ); + values += delim + quotedValue( v, mAttributeFields.at( idx ).type() ); } } else @@ -2091,7 +2091,7 @@ bool QgsOracleProvider::setSubsetString( const QString& theSQL, bool updateFeatu } qry.finish(); - if ( mPrimaryKeyType == pktInt && !uniqueData( mQuery, mAttributeFields[ mPrimaryKeyAttrs[0] ].name() ) ) + if ( mPrimaryKeyType == pktInt && !uniqueData( mQuery, mAttributeFields.at( mPrimaryKeyAttrs[0] ).name() ) ) { mSqlWhereClause = prevWhere; return false; @@ -2649,7 +2649,7 @@ QgsVectorLayerImport::ImportError QgsOracleProvider::createEmptyLayer( int idx = fields.indexFromName( primaryKey ); if ( idx >= 0 ) { - QgsField fld = fields[idx]; + QgsField fld = fields.at( idx ); if ( convertField( fld ) ) { primaryKeyType = fld.typeName(); @@ -2856,7 +2856,7 @@ QgsVectorLayerImport::ImportError QgsOracleProvider::createEmptyLayer( QList launderedFields; for ( int i = 0; i < fields.size(); i++ ) { - QgsField fld = fields[i]; + QgsField fld = fields.at( i ); QString name = fld.name().left( 30 ).toUpper(); diff --git a/src/providers/postgres/qgspostgresprovider.cpp b/src/providers/postgres/qgspostgresprovider.cpp index 3b4b43bfd557..4e79cc67cfff 100644 --- a/src/providers/postgres/qgspostgresprovider.cpp +++ b/src/providers/postgres/qgspostgresprovider.cpp @@ -544,12 +544,12 @@ QString QgsPostgresUtils::whereClause( QgsFeatureId featureId, const QgsFields& case pktInt: Q_ASSERT( pkAttrs.size() == 1 ); - whereClause = QString( "%1=%2" ).arg( QgsPostgresConn::quotedIdentifier( fields[ pkAttrs[0] ].name() ) ).arg( FID2PKINT( featureId ) ); + whereClause = QString( "%1=%2" ).arg( QgsPostgresConn::quotedIdentifier( fields.at( pkAttrs[0] ).name() ) ).arg( FID2PKINT( featureId ) ); break; case pktUint64: Q_ASSERT( pkAttrs.size() == 1 ); - whereClause = QString( "%1=%2" ).arg( QgsPostgresConn::quotedIdentifier( fields[ pkAttrs[0] ].name() ) ).arg( featureId ); + whereClause = QString( "%1=%2" ).arg( QgsPostgresConn::quotedIdentifier( fields.at( pkAttrs[0] ).name() ) ).arg( featureId ); break; case pktFidMap: @@ -565,7 +565,7 @@ QString QgsPostgresUtils::whereClause( QgsFeatureId featureId, const QgsFields& for ( int i = 0; i < pkAttrs.size(); i++ ) { int idx = pkAttrs[i]; - QgsField fld = fields[ idx ]; + QgsField fld = fields.at( idx ); whereClause += delim + conn->fieldExpression( fld ); if ( pkVals[i].isNull() ) @@ -607,7 +607,7 @@ QString QgsPostgresUtils::whereClause( const QgsFeatureIds& featureIds, const Qg if ( !featureIds.isEmpty() ) { QString delim; - expr = QString( "%1 IN (" ).arg(( pkType == pktOid ? "oid" : QgsPostgresConn::quotedIdentifier( fields[ pkAttrs[0] ].name() ) ) ); + expr = QString( "%1 IN (" ).arg(( pkType == pktOid ? "oid" : QgsPostgresConn::quotedIdentifier( fields.at( pkAttrs[0] ).name() ) ) ); Q_FOREACH ( const QgsFeatureId featureId, featureIds ) { @@ -3489,7 +3489,7 @@ QgsVectorLayerImport::ImportError QgsPostgresProvider::createEmptyLayer( const Q QString pk = primaryKey = "id"; for ( int fldIdx = 0; fldIdx < fields.count(); ++fldIdx ) { - if ( fields[fldIdx].name() == primaryKey ) + if ( fields.at( fldIdx ).name() == primaryKey ) { // it already exists, try again with a new name primaryKey = QString( "%1_%2" ).arg( pk ).arg( index++ ); @@ -3502,10 +3502,10 @@ QgsVectorLayerImport::ImportError QgsPostgresProvider::createEmptyLayer( const Q // search for the passed field for ( int fldIdx = 0; fldIdx < fields.count(); ++fldIdx ) { - if ( fields[fldIdx].name() == primaryKey ) + if ( fields.at( fldIdx ).name() == primaryKey ) { // found, get the field type - QgsField fld = fields[fldIdx]; + QgsField fld = fields.at( fldIdx ); if ( convertField( fld, options ) ) { primaryKeyType = fld.typeName(); @@ -3658,7 +3658,7 @@ QgsVectorLayerImport::ImportError QgsPostgresProvider::createEmptyLayer( const Q QList flist; for ( int fldIdx = 0; fldIdx < fields.count(); ++fldIdx ) { - QgsField fld = fields[fldIdx]; + QgsField fld = fields.at( fldIdx ); if ( fld.name() == geometryColumn ) { diff --git a/src/providers/spatialite/qgsspatialiteprovider.cpp b/src/providers/spatialite/qgsspatialiteprovider.cpp index dd8e74a563a7..0582c95b62c4 100644 --- a/src/providers/spatialite/qgsspatialiteprovider.cpp +++ b/src/providers/spatialite/qgsspatialiteprovider.cpp @@ -144,7 +144,7 @@ QgsSpatiaLiteProvider::createEmptyLayer( const QString& uri, QString pk = primaryKey = "pk"; for ( int fldIdx = 0; fldIdx < fields.count(); ++fldIdx ) { - if ( fields[fldIdx].name() == primaryKey ) + if ( fields.at( fldIdx ).name() == primaryKey ) { // it already exists, try again with a new name primaryKey = QString( "%1_%2" ).arg( pk ).arg( index++ ); @@ -157,10 +157,10 @@ QgsSpatiaLiteProvider::createEmptyLayer( const QString& uri, // search for the passed field for ( int fldIdx = 0; fldIdx < fields.count(); ++fldIdx ) { - if ( fields[fldIdx].name() == primaryKey ) + if ( fields.at( fldIdx ).name() == primaryKey ) { // found, get the field type - QgsField fld = fields[fldIdx]; + QgsField fld = fields.at( fldIdx ); if ( convertField( fld ) ) { primaryKeyType = fld.typeName(); @@ -357,7 +357,7 @@ QgsSpatiaLiteProvider::createEmptyLayer( const QString& uri, QList flist; for ( int fldIdx = 0; fldIdx < fields.count(); ++fldIdx ) { - QgsField fld = fields[fldIdx]; + QgsField fld = fields.at( fldIdx ); if ( fld.name() == primaryKey ) continue; diff --git a/src/providers/wfs/qgswfsprovider.cpp b/src/providers/wfs/qgswfsprovider.cpp index d1f4b9c13a1f..d8f6ead1f6a0 100644 --- a/src/providers/wfs/qgswfsprovider.cpp +++ b/src/providers/wfs/qgswfsprovider.cpp @@ -618,9 +618,9 @@ bool QgsWFSProvider::processSQL( const QString& sqlString, QString& errorMsg, QS return false; } - QgsField field( fieldName, tableFields[idx].type(), tableFields[idx].typeName() ); + QgsField field( fieldName, tableFields.at( idx ).type(), tableFields.at( idx ).typeName() ); mapFieldNameToSrcLayerNameFieldName[ field.name()] = - QPair( columnTableTypename, tableFields[idx].name() ); + QPair( columnTableTypename, tableFields.at( idx ).name() ); mShared->mFields.append( field ); } } diff --git a/src/server/qgswfsprojectparser.cpp b/src/server/qgswfsprojectparser.cpp index 0cd60decbfe0..f9d42afa9a7a 100644 --- a/src/server/qgswfsprojectparser.cpp +++ b/src/server/qgswfsprojectparser.cpp @@ -465,7 +465,7 @@ void QgsWfsProjectParser::describeFeatureType( const QString& aTypeName, QDomEle //xsd:element QDomElement attElem = doc.createElement( "element"/*xsd:element*/ ); attElem.setAttribute( "name", attributeName ); - QVariant::Type attributeType = fields[idx].type(); + QVariant::Type attributeType = fields.at( idx ).type(); if ( attributeType == QVariant::Int ) attElem.setAttribute( "type", "integer" ); else if ( attributeType == QVariant::LongLong ) diff --git a/src/server/qgswmsserver.cpp b/src/server/qgswmsserver.cpp index d70dafb3c162..97e6630400cd 100644 --- a/src/server/qgswmsserver.cpp +++ b/src/server/qgswmsserver.cpp @@ -2305,13 +2305,13 @@ int QgsWmsServer::featureInfoFromVectorLayer( QgsVectorLayer* layer, for ( int i = 0; i < featureAttributes.count(); ++i ) { //skip attribute if it is explicitly excluded from WMS publication - if ( excludedAttributes.contains( fields[i].name() ) ) + if ( excludedAttributes.contains( fields.at( i ).name() ) ) { continue; } #ifdef HAVE_SERVER_PYTHON_PLUGINS //skip attribute if it is excluded by access control - if ( !attributes.contains( fields[i].name() ) ) + if ( !attributes.contains( fields.at( i ).name() ) ) { continue; }