Avoid potential QgsFields detachments

This commit is contained in:
Nyall Dawson 2016-08-02 11:57:17 +10:00
parent ed4d34fdbc
commit 4f3564cc7b
25 changed files with 68 additions and 68 deletions

View File

@ -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() ) )
{

View File

@ -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:

View File

@ -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();

View File

@ -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;

View File

@ -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++ )

View File

@ -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 )

View File

@ -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 ) );

View File

@ -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 );

View File

@ -241,7 +241,7 @@ void QgsComposerAttributeTable::setDisplayAttributes( const QSet<int>& 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 );

View File

@ -338,7 +338,7 @@ void QgsComposerAttributeTableV2::setDisplayAttributes( const QSet<int>& 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 );
}

View File

@ -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 );

View File

@ -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<LayerProperties>& laye
mThematicAttributes.clear();
for ( int i = 0; i < fields.size(); i++ )
{
QMap< QString, QPair<QString, QString> >::const_iterator att_it = mapFieldNameToSrcLayerNameFieldName.constFind( fields[i].name() );
QMap< QString, QPair<QString, QString> >::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;

View File

@ -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() )

View File

@ -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 );

View File

@ -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 );

View File

@ -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();

View File

@ -262,7 +262,7 @@ QString QgsMemoryProvider::dataSourceUri( bool expandAuthConfig ) const
QgsAttributeList attrs = const_cast<QgsMemoryProvider *>( 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 );

View File

@ -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<QgsField> 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 );

View File

@ -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 );

View File

@ -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<QgsField> 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();

View File

@ -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<QgsField> flist;
for ( int fldIdx = 0; fldIdx < fields.count(); ++fldIdx )
{
QgsField fld = fields[fldIdx];
QgsField fld = fields.at( fldIdx );
if ( fld.name() == geometryColumn )
{

View File

@ -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<QgsField> flist;
for ( int fldIdx = 0; fldIdx < fields.count(); ++fldIdx )
{
QgsField fld = fields[fldIdx];
QgsField fld = fields.at( fldIdx );
if ( fld.name() == primaryKey )
continue;

View File

@ -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<QString, QString>( columnTableTypename, tableFields[idx].name() );
QPair<QString, QString>( columnTableTypename, tableFields.at( idx ).name() );
mShared->mFields.append( field );
}
}

View File

@ -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 )

View File

@ -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;
}