Skip to content
Permalink
Browse files

Switch some for-based loops over fields to Q_FOREACH

  • Loading branch information
m-kuhn committed Mar 9, 2016
1 parent f27d36c commit f4c5106454b6239dcdee18814388609c3309785e
@@ -184,8 +184,8 @@ void QgsOverlayAnalyzer::intersectFeature( QgsFeature& f, QgsVectorFileWriter* v
void QgsOverlayAnalyzer::combineFieldLists( QgsFields& fieldListA, const QgsFields& fieldListB )
{
QList<QString> names;
for ( int idx = 0; idx < fieldListA.count(); ++idx )
names.append( fieldListA.at( idx ).name() );
Q_FOREACH ( const QgsField& field, fieldListA )
names.append( field.name() );

for ( int idx = 0; idx < fieldListB.count(); ++idx )
{
@@ -68,8 +68,8 @@ QgsAttributeActionDialog::QgsAttributeActionDialog( QgsAttributeAction* actions,
// Populate the combo box with the field names. Will the field names
// change? If so, they need to be passed into the init() call, or
// some access to them retained in this class.
for ( int idx = 0; idx < fields.count(); ++idx )
fieldComboBox->addItem( fields[idx].name() );
Q_FOREACH ( const QgsField& field, fields )
fieldComboBox->addItem( field.name() );
}

void QgsAttributeActionDialog::init()
@@ -91,9 +91,9 @@ void QgsClipboard::setSystemClipboard()
textFields += "wkt_geom";
}

for ( int idx = 0; idx < mFeatureFields.count(); ++idx )
Q_FOREACH ( const QgsField& field, mFeatureFields )
{
textFields += mFeatureFields.at( idx ).name();
textFields += field.name();
}
textLines += textFields.join( "\t" );
textFields.clear();
@@ -146,10 +146,9 @@ void QgsJoinDialog::joinedLayerChanged( QgsMapLayer* layer )

mUseJoinFieldsSubset->setChecked( false );
QStandardItemModel* subsetModel = new QStandardItemModel( this );
const QgsFields& layerFields = vLayer->fields();
for ( int idx = 0; idx < layerFields.count(); ++idx )
Q_FOREACH ( const QgsField& field, vLayer->fields() )
{
QStandardItem* subsetItem = new QStandardItem( layerFields[idx].name() );
QStandardItem* subsetItem = new QStandardItem( field.name() );
subsetItem->setCheckable( true );
//subsetItem->setFlags( subsetItem->flags() | Qt::ItemIsUserCheckable );
subsetModel->appendRow( subsetItem );
@@ -226,11 +226,9 @@ QString QgsVectorDataProvider::capabilitiesString() const

int QgsVectorDataProvider::fieldNameIndex( const QString& fieldName ) const
{
const QgsFields &theFields = fields();

for ( int i = 0; i < theFields.count(); ++i )
Q_FOREACH ( const QgsField& field, fields() )
{
if ( QString::compare( theFields[i].name(), fieldName, Qt::CaseInsensitive ) == 0 )
if ( QString::compare( field.name(), fieldName, Qt::CaseInsensitive ) == 0 )
{
return i;
}

0 comments on commit f4c5106

Please sign in to comment.
You can’t perform that action at this time.