mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
QgsFields returns QgsField value instead of const references
(since QgsField is implicitly shared)
This commit is contained in:
parent
967d37adc7
commit
ed4d34fdbc
@ -271,6 +271,12 @@ None will need to be modified, as the method will return an empty geometry if th
|
||||
<li>The method capabilities() returns QgsFeatureRendererV2::Capabilities flags instead of an integer. The two are binary compatible.
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsFields QgsFields
|
||||
|
||||
<ul>
|
||||
<li>All const methods which return a field from QgsFields now return a QgsField value, not a reference.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsGeometry QgsGeometry
|
||||
|
||||
<ul>
|
||||
|
@ -262,7 +262,7 @@ class QgsFields
|
||||
%End
|
||||
|
||||
//! Get field at particular index (must be in range 0..N-1)
|
||||
const QgsField& at( int i ) const /Factory/;
|
||||
QgsField at( int i ) const /Factory/;
|
||||
%MethodCode
|
||||
if ( a0 < 0 || a0 >= sipCpp->count() )
|
||||
{
|
||||
@ -276,7 +276,7 @@ class QgsFields
|
||||
%End
|
||||
|
||||
//! Get field at particular index (must be in range 0..N-1)
|
||||
const QgsField& field( int fieldIdx ) const /Factory/;
|
||||
QgsField field( int fieldIdx ) const /Factory/;
|
||||
%MethodCode
|
||||
if ( a0 < 0 || a0 >= sipCpp->count() )
|
||||
{
|
||||
@ -290,7 +290,7 @@ class QgsFields
|
||||
%End
|
||||
|
||||
//! Get field at particular index (must be in range 0..N-1)
|
||||
const QgsField& field( const QString& name ) const /Factory/;
|
||||
QgsField field( const QString& name ) const /Factory/;
|
||||
%MethodCode
|
||||
int fieldIdx = sipCpp->indexFromName(*a0);
|
||||
if (fieldIdx == -1)
|
||||
|
@ -271,7 +271,7 @@ void QgsVectorLayerSaveAsDialog::on_mFormatComboBox_currentIndexChanged( int idx
|
||||
|
||||
for ( int i = 0; i < mLayer->fields().size(); ++i )
|
||||
{
|
||||
const QgsField &fld = mLayer->fields().at( i );
|
||||
QgsField fld = mLayer->fields().at( i );
|
||||
Qt::ItemFlags flags = mLayer->providerType() != "oracle" || !fld.typeName().contains( "SDO_GEOMETRY" ) ? Qt::ItemIsEnabled : Qt::NoItemFlags;
|
||||
QTableWidgetItem *item;
|
||||
item = new QTableWidgetItem( fld.name() );
|
||||
|
@ -6848,7 +6848,7 @@ void QgisApp::mergeAttributesOfSelectedFeatures()
|
||||
continue;
|
||||
|
||||
QVariant val = merged.at( i );
|
||||
const QgsField &fld( vl->fields().at( i ) );
|
||||
QgsField fld( vl->fields().at( i ) );
|
||||
bool isDefaultValue = vl->fields().fieldOrigin( i ) == QgsFields::OriginProvider &&
|
||||
vl->dataProvider() &&
|
||||
vl->dataProvider()->defaultValue( vl->fields().fieldOriginIndex( i ) ) == val;
|
||||
|
@ -382,17 +382,17 @@ QgsField &QgsFields::operator[]( int i )
|
||||
return d->fields[i].field;
|
||||
}
|
||||
|
||||
const QgsField &QgsFields::at( int i ) const
|
||||
QgsField QgsFields::at( int i ) const
|
||||
{
|
||||
return d->fields[i].field;
|
||||
}
|
||||
|
||||
const QgsField &QgsFields::field( int fieldIdx ) const
|
||||
QgsField QgsFields::field( int fieldIdx ) const
|
||||
{
|
||||
return d->fields[fieldIdx].field;
|
||||
}
|
||||
|
||||
const QgsField &QgsFields::field( const QString &name ) const
|
||||
QgsField QgsFields::field( const QString &name ) const
|
||||
{
|
||||
return d->fields[ indexFromName( name )].field;
|
||||
}
|
||||
@ -403,7 +403,7 @@ const QgsField &QgsFields::field( const QString &name ) const
|
||||
* See details in QEP #17
|
||||
****************************************************************************/
|
||||
|
||||
const QgsField &QgsFields::operator[]( int i ) const
|
||||
QgsField QgsFields::operator[]( int i ) const
|
||||
{
|
||||
return d->fields[i].field;
|
||||
}
|
||||
|
@ -255,15 +255,15 @@ class CORE_EXPORT QgsFields
|
||||
bool exists( int i ) const;
|
||||
|
||||
//! Get field at particular index (must be in range 0..N-1)
|
||||
const QgsField& operator[]( int i ) const;
|
||||
QgsField operator[]( int i ) const;
|
||||
//! Get field at particular index (must be in range 0..N-1)
|
||||
QgsField& operator[]( int i );
|
||||
//! Get field at particular index (must be in range 0..N-1)
|
||||
const QgsField& at( int i ) const;
|
||||
QgsField at( int i ) const;
|
||||
//! Get field at particular index (must be in range 0..N-1)
|
||||
const QgsField& field( int fieldIdx ) const;
|
||||
//! Get field at particular index (must be in range 0..N-1)
|
||||
const QgsField& field( const QString& name ) const;
|
||||
QgsField field( int fieldIdx ) const;
|
||||
//! Get field with matching name
|
||||
QgsField field( const QString& name ) const;
|
||||
|
||||
//! Get field's origin (value from an enumeration)
|
||||
FieldOrigin fieldOrigin( int fieldIdx ) const;
|
||||
|
@ -2174,7 +2174,7 @@ QgsVectorFileWriter::WriterError QgsVectorFileWriter::writeAsVectorFormat( QgsVe
|
||||
{
|
||||
Q_FOREACH ( int idx, layer->attributeList() )
|
||||
{
|
||||
const QgsField &fld = layer->fields()[idx];
|
||||
QgsField fld = layer->fields().at( idx );
|
||||
if ( layer->providerType() == "oracle" && fld.typeName().contains( "SDO_GEOMETRY" ) )
|
||||
continue;
|
||||
attributes.append( idx );
|
||||
@ -2186,7 +2186,7 @@ QgsVectorFileWriter::WriterError QgsVectorFileWriter::writeAsVectorFormat( QgsVe
|
||||
{
|
||||
Q_FOREACH ( int attrIdx, attributes )
|
||||
{
|
||||
fields.append( layer->fields()[attrIdx] );
|
||||
fields.append( layer->fields().at( attrIdx ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3757,7 +3757,7 @@ QString QgsVectorLayer::metadata() const
|
||||
const QgsFields& myFields = pendingFields();
|
||||
for ( int i = 0, n = myFields.size(); i < n; ++i )
|
||||
{
|
||||
const QgsField& myField = fields[i];
|
||||
QgsField myField = fields.at( i );
|
||||
|
||||
myMetadata += "<tr><td>";
|
||||
myMetadata += myField.name();
|
||||
|
@ -418,8 +418,8 @@ bool QgsVectorLayerEditBuffer::commitChanges( QStringList& commitErrors )
|
||||
|
||||
for ( int i = 0; i < qMin( oldFields.count(), newFields.count() ); ++i )
|
||||
{
|
||||
const QgsField& oldField = oldFields.at( i );
|
||||
const QgsField& newField = newFields.at( i );
|
||||
QgsField oldField = oldFields.at( i );
|
||||
QgsField newField = newFields.at( i );
|
||||
if ( attributeChangesOk && oldField != newField )
|
||||
{
|
||||
commitErrors
|
||||
|
@ -296,7 +296,7 @@ void QgsEditorWidgetRegistry::writeMapLayer( QgsMapLayer* mapLayer, QDomElement&
|
||||
QgsFields fields = vectorLayer->fields();
|
||||
for ( int idx = 0; idx < fields.count(); ++idx )
|
||||
{
|
||||
const QgsField &field = fields.at( idx );
|
||||
QgsField field = fields.at( idx );
|
||||
const QString& widgetType = vectorLayer->editFormConfig()->widgetType( idx );
|
||||
if ( !mWidgetFactories.contains( widgetType ) )
|
||||
{
|
||||
|
@ -338,7 +338,7 @@ bool QgsDb2FeatureIterator::fetchFeature( QgsFeature& feature )
|
||||
{
|
||||
v = QVariant( v.toString() );
|
||||
}
|
||||
const QgsField &fld = mSource->mFields.at( mAttributesToFetch.at( i ) );
|
||||
QgsField fld = mSource->mFields.at( mAttributesToFetch.at( i ) );
|
||||
// QgsDebugMsg( QString( "v.type: %1; fld.type: %2" ).arg( v.type() ).arg( fld.type() ) );
|
||||
if ( v.type() != fld.type() )
|
||||
{
|
||||
|
@ -300,7 +300,7 @@ bool QgsMssqlFeatureIterator::fetchFeature( QgsFeature& feature )
|
||||
for ( int i = 0; i < mAttributesToFetch.count(); i++ )
|
||||
{
|
||||
QVariant v = mQuery->value( i );
|
||||
const QgsField &fld = mSource->mFields.at( mAttributesToFetch.at( i ) );
|
||||
QgsField fld = mSource->mFields.at( mAttributesToFetch.at( i ) );
|
||||
if ( v.type() != fld.type() )
|
||||
v = QgsVectorDataProvider::convertValue( fld.type(), v.toString() );
|
||||
feature.setAttribute( mAttributesToFetch.at( i ), v );
|
||||
|
@ -2726,7 +2726,7 @@ void QgsOgrProvider::uniqueValues( int index, QList<QVariant> &uniqueValues, int
|
||||
if ( !mValid || index < 0 || index >= mAttributeFields.count() )
|
||||
return;
|
||||
|
||||
const QgsField& fld = mAttributeFields.at( index );
|
||||
QgsField fld = mAttributeFields.at( index );
|
||||
if ( fld.name().isNull() )
|
||||
{
|
||||
return; //not a provider field
|
||||
@ -2774,7 +2774,7 @@ QVariant QgsOgrProvider::minimumValue( int index ) const
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
const QgsField& fld = mAttributeFields.at( index );
|
||||
QgsField fld = mAttributeFields.at( index );
|
||||
|
||||
// Don't quote column name (see https://trac.osgeo.org/gdal/ticket/5799#comment:9)
|
||||
QByteArray sql = "SELECT MIN(" + mEncoding->fromUnicode( fld.name() );
|
||||
@ -2813,7 +2813,7 @@ QVariant QgsOgrProvider::maximumValue( int index ) const
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
const QgsField& fld = mAttributeFields.at( index );
|
||||
QgsField fld = mAttributeFields.at( index );
|
||||
|
||||
// Don't quote column name (see https://trac.osgeo.org/gdal/ticket/5799#comment:9)
|
||||
QByteArray sql = "SELECT MAX(" + mEncoding->fromUnicode( fld.name() );
|
||||
|
@ -337,7 +337,7 @@ bool QgsOracleFeatureIterator::fetchFeature( QgsFeature& feature )
|
||||
{
|
||||
Q_FOREACH ( int idx, mSource->mPrimaryKeyAttrs )
|
||||
{
|
||||
const QgsField &fld = mSource->mFields[idx];
|
||||
QgsField fld = mSource->mFields.at( idx );
|
||||
|
||||
QVariant v = mQry.value( col );
|
||||
if ( v.type() != fld.type() )
|
||||
@ -373,7 +373,7 @@ bool QgsOracleFeatureIterator::fetchFeature( QgsFeature& feature )
|
||||
if ( mSource->mPrimaryKeyAttrs.contains( idx ) )
|
||||
continue;
|
||||
|
||||
const QgsField &fld = mSource->mFields[idx];
|
||||
QgsField fld = mSource->mFields.at( idx );
|
||||
|
||||
QVariant v = mQry.value( col );
|
||||
if ( fld.type() == QVariant::ByteArray && fld.typeName().endsWith( ".SDO_GEOMETRY" ) )
|
||||
|
@ -338,7 +338,7 @@ QString QgsOracleProvider::pkParamWhereClause() const
|
||||
for ( int i = 0; i < mPrimaryKeyAttrs.size(); i++ )
|
||||
{
|
||||
int idx = mPrimaryKeyAttrs[i];
|
||||
const QgsField &fld = field( idx );
|
||||
QgsField fld = field( idx );
|
||||
|
||||
whereClause += delim + QString( "%1=?" ).arg( mConnection->fieldExpression( fld ) );
|
||||
delim = " AND ";
|
||||
@ -435,7 +435,7 @@ QString QgsOracleUtils::whereClause( QgsFeatureId featureId, const QgsFields& fi
|
||||
for ( int i = 0; i < primaryKeyAttrs.size(); i++ )
|
||||
{
|
||||
int idx = primaryKeyAttrs[i];
|
||||
const QgsField &fld = fields[ idx ];
|
||||
QgsField fld = fields.at( idx );
|
||||
|
||||
whereClause += delim + QString( "%1=%2" ).arg( QgsOracleConn::fieldExpression( fld ) ).arg( QgsOracleConn::quotedValue( pkVals[i], fld.type() ) );
|
||||
delim = " AND ";
|
||||
@ -504,7 +504,7 @@ QgsWkbTypes::Type QgsOracleProvider::wkbType() const
|
||||
return mRequestedGeomType != QgsWkbTypes::Unknown ? mRequestedGeomType : mDetectedGeomType;
|
||||
}
|
||||
|
||||
const QgsField &QgsOracleProvider::field( int index ) const
|
||||
QgsField QgsOracleProvider::field( int index ) const
|
||||
{
|
||||
if ( index < 0 || index >= mAttributeFields.size() )
|
||||
{
|
||||
@ -512,7 +512,7 @@ const QgsField &QgsOracleProvider::field( int index ) const
|
||||
throw OracleFieldNotFound();
|
||||
}
|
||||
|
||||
return mAttributeFields[ index ];
|
||||
return mAttributeFields.at( index );
|
||||
}
|
||||
|
||||
QgsFeatureIterator QgsOracleProvider::getFeatures( const QgsFeatureRequest& request ) const
|
||||
@ -900,7 +900,7 @@ bool QgsOracleProvider::determinePrimaryKey()
|
||||
return false;
|
||||
}
|
||||
|
||||
const QgsField &fld = mAttributeFields.at( idx );
|
||||
QgsField fld = mAttributeFields.at( idx );
|
||||
|
||||
if ( isInt &&
|
||||
fld.type() != QVariant::Int &&
|
||||
@ -937,7 +937,7 @@ bool QgsOracleProvider::determinePrimaryKey()
|
||||
|
||||
if ( idx >= 0 )
|
||||
{
|
||||
const QgsField &fld = mAttributeFields.at( idx );
|
||||
QgsField fld = mAttributeFields.at( idx );
|
||||
|
||||
if ( mUseEstimatedMetadata || uniqueData( mQuery, primaryKey ) )
|
||||
{
|
||||
@ -1027,7 +1027,7 @@ QVariant QgsOracleProvider::minimumValue( int index ) const
|
||||
try
|
||||
{
|
||||
// get the field name
|
||||
const QgsField &fld = field( index );
|
||||
QgsField fld = field( index );
|
||||
QString sql = QString( "SELECT min(%1) FROM %2" )
|
||||
.arg( quotedIdentifier( fld.name() ) )
|
||||
.arg( mQuery );
|
||||
@ -1070,7 +1070,7 @@ void QgsOracleProvider::uniqueValues( int index, QList<QVariant> &uniqueValues,
|
||||
try
|
||||
{
|
||||
// get the field name
|
||||
const QgsField &fld = field( index );
|
||||
QgsField fld = field( index );
|
||||
QString sql = QString( "SELECT DISTINCT %1 FROM %2" )
|
||||
.arg( quotedIdentifier( fld.name() ) )
|
||||
.arg( mQuery );
|
||||
@ -1117,7 +1117,7 @@ QVariant QgsOracleProvider::maximumValue( int index ) const
|
||||
try
|
||||
{
|
||||
// get the field name
|
||||
const QgsField &fld = field( index );
|
||||
QgsField fld = field( index );
|
||||
QString sql = QString( "SELECT max(%1) FROM %2" )
|
||||
.arg( quotedIdentifier( fld.name() ) )
|
||||
.arg( mQuery );
|
||||
@ -1227,7 +1227,7 @@ bool QgsOracleProvider::addFeatures( QgsFeatureList &flist )
|
||||
|
||||
Q_FOREACH ( int idx, mPrimaryKeyAttrs )
|
||||
{
|
||||
const QgsField &fld = field( idx );
|
||||
QgsField fld = field( idx );
|
||||
insert += delim + quotedIdentifier( fld.name() );
|
||||
keys += kdelim + quotedIdentifier( fld.name() );
|
||||
values += delim + "?";
|
||||
@ -1256,7 +1256,7 @@ bool QgsOracleProvider::addFeatures( QgsFeatureList &flist )
|
||||
if ( fieldId.contains( idx ) )
|
||||
continue;
|
||||
|
||||
const QgsField &fld = mAttributeFields[idx];
|
||||
QgsField fld = mAttributeFields.at( idx );
|
||||
|
||||
QgsDebugMsgLevel( "Checking field against: " + fld.name(), 4 );
|
||||
|
||||
@ -1339,7 +1339,7 @@ bool QgsOracleProvider::addFeatures( QgsFeatureList &flist )
|
||||
QString v;
|
||||
if ( !value.isValid() )
|
||||
{
|
||||
const QgsField &fld = field( fieldId[i] );
|
||||
QgsField fld = field( fieldId[i] );
|
||||
v = paramValue( defaultValues[i], defaultValues[i] );
|
||||
features->setAttribute( fieldId[i], convertValue( fld.type(), v ) );
|
||||
}
|
||||
@ -1349,7 +1349,7 @@ bool QgsOracleProvider::addFeatures( QgsFeatureList &flist )
|
||||
|
||||
if ( v != value.toString() )
|
||||
{
|
||||
const QgsField &fld = field( fieldId[i] );
|
||||
QgsField fld = field( fieldId[i] );
|
||||
features->setAttribute( fieldId[i], convertValue( fld.type(), v ) );
|
||||
}
|
||||
}
|
||||
@ -1375,7 +1375,7 @@ bool QgsOracleProvider::addFeatures( QgsFeatureList &flist )
|
||||
int col = 0;
|
||||
Q_FOREACH ( int idx, mPrimaryKeyAttrs )
|
||||
{
|
||||
const QgsField &fld = field( idx );
|
||||
QgsField fld = field( idx );
|
||||
|
||||
QVariant v = getfid.value( col++ );
|
||||
if ( v.type() != fld.type() )
|
||||
@ -1590,7 +1590,7 @@ bool QgsOracleProvider::deleteAttributes( const QgsAttributeIds& ids )
|
||||
|
||||
Q_FOREACH ( int id, idsList )
|
||||
{
|
||||
const QgsField &fld = mAttributeFields.at( id );
|
||||
QgsField fld = mAttributeFields.at( id );
|
||||
|
||||
QString sql = QString( "ALTER TABLE %1 DROP COLUMN %2" )
|
||||
.arg( mQuery )
|
||||
@ -1751,7 +1751,7 @@ bool QgsOracleProvider::changeAttributeValues( const QgsChangedAttributesMap &at
|
||||
{
|
||||
try
|
||||
{
|
||||
const QgsField &fld = field( siter.key() );
|
||||
QgsField fld = field( siter.key() );
|
||||
|
||||
pkChanged = pkChanged || mPrimaryKeyAttrs.contains( siter.key() );
|
||||
|
||||
|
@ -292,7 +292,7 @@ class QgsOracleProvider : public QgsVectorDataProvider
|
||||
|
||||
bool hasSufficientPermsAndCapabilities();
|
||||
|
||||
const QgsField &field( int index ) const;
|
||||
QgsField field( int index ) const;
|
||||
|
||||
/** Load the field list
|
||||
*/
|
||||
|
@ -737,7 +737,7 @@ bool QgsPostgresFeatureIterator::getFeature( QgsPostgresResult &queryResult, int
|
||||
|
||||
Q_FOREACH ( int idx, mSource->mPrimaryKeyAttrs )
|
||||
{
|
||||
const QgsField &fld = mSource->mFields.at( idx );
|
||||
QgsField fld = mSource->mFields.at( idx );
|
||||
|
||||
QVariant v = QgsPostgresProvider::convertValue( fld.type(), queryResult.PQgetvalue( row, col ) );
|
||||
primaryKeyVals << v;
|
||||
|
@ -444,7 +444,7 @@ QString QgsPostgresProvider::pkParamWhereClause( int offset, const char *alias )
|
||||
for ( int i = 0; i < mPrimaryKeyAttrs.size(); i++ )
|
||||
{
|
||||
int idx = mPrimaryKeyAttrs[i];
|
||||
const QgsField &fld = field( idx );
|
||||
QgsField fld = field( idx );
|
||||
|
||||
whereClause += delim + QString( "%3%1=$%2" ).arg( connectionRO()->fieldExpression( fld ) ).arg( offset++ ).arg( aliased );
|
||||
delim = " AND ";
|
||||
@ -565,7 +565,7 @@ QString QgsPostgresUtils::whereClause( QgsFeatureId featureId, const QgsFields&
|
||||
for ( int i = 0; i < pkAttrs.size(); i++ )
|
||||
{
|
||||
int idx = pkAttrs[i];
|
||||
const QgsField &fld = fields[ idx ];
|
||||
QgsField fld = fields[ idx ];
|
||||
|
||||
whereClause += delim + conn->fieldExpression( fld );
|
||||
if ( pkVals[i].isNull() )
|
||||
@ -691,7 +691,7 @@ QgsWkbTypes::Type QgsPostgresProvider::wkbType() const
|
||||
return mRequestedGeomType != QgsWkbTypes::Unknown ? mRequestedGeomType : mDetectedGeomType;
|
||||
}
|
||||
|
||||
const QgsField &QgsPostgresProvider::field( int index ) const
|
||||
QgsField QgsPostgresProvider::field( int index ) const
|
||||
{
|
||||
if ( index < 0 || index >= mAttributeFields.count() )
|
||||
{
|
||||
@ -699,7 +699,7 @@ const QgsField &QgsPostgresProvider::field( int index ) const
|
||||
throw PGFieldNotFound();
|
||||
}
|
||||
|
||||
return mAttributeFields[index];
|
||||
return mAttributeFields.at( index );
|
||||
}
|
||||
|
||||
QgsFields QgsPostgresProvider::fields() const
|
||||
@ -1350,7 +1350,7 @@ bool QgsPostgresProvider::determinePrimaryKey()
|
||||
QgsDebugMsg( "Skipping " + name );
|
||||
continue;
|
||||
}
|
||||
const QgsField& fld = mAttributeFields.at( idx );
|
||||
QgsField fld = mAttributeFields.at( idx );
|
||||
|
||||
// Always use pktFidMap for multi-field keys
|
||||
mPrimaryKeyType = i ? pktFidMap : pkType( fld );
|
||||
@ -1448,7 +1448,7 @@ void QgsPostgresProvider::determinePrimaryKeyFromUriKeyColumn()
|
||||
mPrimaryKeyType = pktFidMap; // Map by default
|
||||
if ( mPrimaryKeyAttrs.size() == 1 )
|
||||
{
|
||||
const QgsField& fld = mAttributeFields.at( 0 );
|
||||
QgsField fld = mAttributeFields.at( 0 );
|
||||
mPrimaryKeyType = pkType( fld );
|
||||
}
|
||||
}
|
||||
@ -1493,7 +1493,7 @@ QVariant QgsPostgresProvider::minimumValue( int index ) const
|
||||
try
|
||||
{
|
||||
// get the field name
|
||||
const QgsField &fld = field( index );
|
||||
QgsField fld = field( index );
|
||||
QString sql = QString( "SELECT min(%1) AS %1 FROM %2" )
|
||||
.arg( quotedIdentifier( fld.name() ),
|
||||
mQuery );
|
||||
@ -1522,7 +1522,7 @@ void QgsPostgresProvider::uniqueValues( int index, QList<QVariant> &uniqueValues
|
||||
try
|
||||
{
|
||||
// get the field name
|
||||
const QgsField &fld = field( index );
|
||||
QgsField fld = field( index );
|
||||
QString sql = QString( "SELECT DISTINCT %1 FROM %2" )
|
||||
.arg( quotedIdentifier( fld.name() ),
|
||||
mQuery );
|
||||
@ -1668,7 +1668,7 @@ QVariant QgsPostgresProvider::maximumValue( int index ) const
|
||||
try
|
||||
{
|
||||
// get the field name
|
||||
const QgsField &fld = field( index );
|
||||
QgsField fld = field( index );
|
||||
QString sql = QString( "SELECT max(%1) AS %1 FROM %2" )
|
||||
.arg( quotedIdentifier( fld.name() ),
|
||||
mQuery );
|
||||
@ -1702,7 +1702,7 @@ QVariant QgsPostgresProvider::defaultValue( int fieldId ) const
|
||||
|
||||
if ( providerProperty( EvaluateDefaultValues, false ).toBool() && !defVal.isNull() )
|
||||
{
|
||||
const QgsField& fld = field( fieldId );
|
||||
QgsField fld = field( fieldId );
|
||||
|
||||
QgsPostgresResult res( connectionRO()->PQexec( QString( "SELECT %1" ).arg( defVal.toString() ) ) );
|
||||
|
||||
@ -2003,7 +2003,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist )
|
||||
QString v;
|
||||
if ( value.isNull() )
|
||||
{
|
||||
const QgsField &fld = field( attrIdx );
|
||||
QgsField fld = field( attrIdx );
|
||||
v = paramValue( defaultValues[ i ], defaultValues[ i ] );
|
||||
features->setAttribute( attrIdx, convertValue( fld.type(), v ) );
|
||||
}
|
||||
@ -2013,7 +2013,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist )
|
||||
|
||||
if ( v != value.toString() )
|
||||
{
|
||||
const QgsField &fld = field( attrIdx );
|
||||
QgsField fld = field( attrIdx );
|
||||
features->setAttribute( attrIdx, convertValue( fld.type(), v ) );
|
||||
}
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ class QgsPostgresProvider : public QgsVectorDataProvider
|
||||
|
||||
bool hasSufficientPermsAndCapabilities();
|
||||
|
||||
const QgsField &field( int index ) const;
|
||||
QgsField field( int index ) const;
|
||||
|
||||
/** Load the field list
|
||||
*/
|
||||
|
@ -3381,7 +3381,7 @@ QVariant QgsSpatiaLiteProvider::minimumValue( int index ) const
|
||||
try
|
||||
{
|
||||
// get the field name
|
||||
const QgsField& fld = field( index );
|
||||
QgsField fld = field( index );
|
||||
|
||||
sql = QString( "SELECT Min(%1) FROM %2" ).arg( quotedIdentifier( fld.name() ), mQuery );
|
||||
|
||||
@ -3444,7 +3444,7 @@ QVariant QgsSpatiaLiteProvider::maximumValue( int index ) const
|
||||
try
|
||||
{
|
||||
// get the field name
|
||||
const QgsField & fld = field( index );
|
||||
QgsField fld = field( index );
|
||||
|
||||
sql = QString( "SELECT Max(%1) FROM %2" ).arg( quotedIdentifier( fld.name() ), mQuery );
|
||||
|
||||
@ -3506,7 +3506,7 @@ void QgsSpatiaLiteProvider::uniqueValues( int index, QList < QVariant > &uniqueV
|
||||
{
|
||||
return; //invalid field
|
||||
}
|
||||
const QgsField& fld = mAttributeFields.at( index );
|
||||
QgsField fld = mAttributeFields.at( index );
|
||||
|
||||
sql = QString( "SELECT DISTINCT %1 FROM %2" ).arg( quotedIdentifier( fld.name() ), mQuery );
|
||||
|
||||
@ -3971,7 +3971,7 @@ bool QgsSpatiaLiteProvider::changeAttributeValues( const QgsChangedAttributesMap
|
||||
// Loop over all changed attributes
|
||||
try
|
||||
{
|
||||
const QgsField& fld = field( siter.key() );
|
||||
QgsField fld = field( siter.key() );
|
||||
const QVariant& val = siter.value();
|
||||
|
||||
if ( !first )
|
||||
@ -4995,7 +4995,7 @@ error:
|
||||
return false;
|
||||
}
|
||||
|
||||
const QgsField & QgsSpatiaLiteProvider::field( int index ) const
|
||||
QgsField QgsSpatiaLiteProvider::field( int index ) const
|
||||
{
|
||||
if ( index < 0 || index >= mAttributeFields.count() )
|
||||
{
|
||||
@ -5003,7 +5003,7 @@ const QgsField & QgsSpatiaLiteProvider::field( int index ) const
|
||||
throw SLFieldNotFound();
|
||||
}
|
||||
|
||||
return mAttributeFields[index];
|
||||
return mAttributeFields.at( index );
|
||||
}
|
||||
|
||||
void QgsSpatiaLiteProvider::invalidateConnections( const QString& connection )
|
||||
|
@ -370,7 +370,7 @@ class QgsSpatiaLiteProvider: public QgsVectorDataProvider
|
||||
|
||||
QgsVectorDataProvider::Capabilities mEnabledCapabilities;
|
||||
|
||||
const QgsField &field( int index ) const;
|
||||
QgsField field( int index ) const;
|
||||
|
||||
//! SpatiaLite version string
|
||||
QString mSpatialiteVersionInfo;
|
||||
|
@ -530,7 +530,7 @@ bool QgsWFSProvider::processSQL( const QString& sqlString, QString& errorMsg, QS
|
||||
const QgsFields tableFields = mapTypenameToFields[columnTableTypename];
|
||||
for ( int i = 0; i < tableFields.size();i++ )
|
||||
{
|
||||
const QgsField& srcField = tableFields[i];
|
||||
QgsField srcField = tableFields.at( i );
|
||||
QString fieldName( srcField.name() );
|
||||
// If several tables selected, prefix by table name
|
||||
if ( typenameList.size() > 1 )
|
||||
@ -562,7 +562,7 @@ bool QgsWFSProvider::processSQL( const QString& sqlString, QString& errorMsg, QS
|
||||
const QgsFields tableFields = mapTypenameToFields[typeName];
|
||||
for ( int i = 0; i < tableFields.size();i++ )
|
||||
{
|
||||
const QgsField& srcField = tableFields[i];
|
||||
QgsField srcField = tableFields.at( i );
|
||||
QString fieldName( srcField.name() );
|
||||
// If several tables selected, prefix by table name
|
||||
if ( typenameList.size() > 1 )
|
||||
|
@ -789,7 +789,7 @@ void QgsServerProjectParser::addLayerProjectSettings( QDomElement& layerElem, QD
|
||||
const QgsFields& layerFields = vLayer->pendingFields();
|
||||
for ( int idx = 0; idx < layerFields.count(); ++idx )
|
||||
{
|
||||
const QgsField& field = layerFields.at( idx );
|
||||
QgsField field = layerFields.at( idx );
|
||||
if ( excludedAttributes.contains( field.name() ) )
|
||||
{
|
||||
continue;
|
||||
|
@ -1603,7 +1603,7 @@ QDomDocument QgsWfsServer::transaction( const QString& requestBody )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const QgsField& field = fields.at( fieldMapIt.value() );
|
||||
QgsField field = fields.at( fieldMapIt.value() );
|
||||
if ( field.type() == 2 )
|
||||
layer->changeAttributeValue( *fidIt, fieldMapIt.value(), it.value().toInt( &conversionSuccess ) );
|
||||
else if ( field.type() == 6 )
|
||||
@ -1740,7 +1740,7 @@ QDomDocument QgsWfsServer::transaction( const QString& requestBody )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const QgsField& field = fields.at( fieldMapIt.value() );
|
||||
QgsField field = fields.at( fieldMapIt.value() );
|
||||
QString attrValue = currentAttributeElement.text();
|
||||
int attrType = field.type();
|
||||
QgsMessageLog::logMessage( QString( "attr: name=%1 idx=%2 value=%3" ).arg( attrName ).arg( fieldMapIt.value() ).arg( attrValue ) );
|
||||
|
@ -111,7 +111,7 @@ void TestQgsDualView::testColumnHeaders()
|
||||
{
|
||||
for ( int i = 0; i < mPointsLayer->fields().count(); ++i )
|
||||
{
|
||||
const QgsField& fld = mPointsLayer->fields().at( i );
|
||||
QgsField fld = mPointsLayer->fields().at( i );
|
||||
QCOMPARE( mDualView->tableView()->model()->headerData( i, Qt::Horizontal ).toString(), fld.name() );
|
||||
}
|
||||
}
|
||||
@ -123,7 +123,7 @@ void TestQgsDualView::testData()
|
||||
|
||||
for ( int i = 0; i < mPointsLayer->fields().count(); ++i )
|
||||
{
|
||||
const QgsField& fld = mPointsLayer->fields().at( i );
|
||||
QgsField fld = mPointsLayer->fields().at( i );
|
||||
|
||||
QModelIndex index = mDualView->tableView()->model()->index( 0, i );
|
||||
QCOMPARE( mDualView->tableView()->model()->data( index ).toString(), fld.displayString( feature.attribute( i ) ) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user