Skip to content

Commit 9076ff8

Browse files
committedMay 20, 2015
Fix some deprecated warnings
1 parent 267d952 commit 9076ff8

15 files changed

+29
-27
lines changed
 

‎src/app/qgsclipboard.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ QgsFeatureList QgsClipboard::copyOf( const QgsFields &fields )
171171

172172
QgsFeature feature;
173173
if ( !fields.isEmpty() )
174-
feature.setFields( &fields, true );
174+
feature.setFields( fields, true );
175175

176176
feature.setGeometry( geometry );
177177
features.append( feature );

‎src/core/qgsfeaturestore.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ void QgsFeatureStore::setFields( const QgsFields & fields )
4242
mFields = fields;
4343
foreach ( QgsFeature feature, mFeatures )
4444
{
45-
feature.setFields( &mFields );
45+
feature.setFields( mFields );
4646
}
4747
}
4848

4949
void QgsFeatureStore::addFeature( const QgsFeature& feature )
5050
{
5151
QgsFeature f( feature );
52-
f.setFields( &mFields );
52+
f.setFields( mFields );
5353
mFeatures.append( f );
5454
}

‎src/core/qgspallabeling.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4129,7 +4129,7 @@ void QgsPalLabeling::drawLabeling( QgsRenderContext& context )
41294129
{
41304130
if ( QString( dit.key() + "d" ) == layerName )
41314131
{
4132-
feature.setFields( &dit.value().fields );
4132+
feature.setFields( dit.value().fields );
41334133
palGeometry->feature( feature );
41344134

41354135
//calculate top-left point for diagram

‎src/core/qgsvectorlayerfeatureiterator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ bool QgsVectorLayerFeatureIterator::fetchFeature( QgsFeature& f )
211211
continue;
212212

213213
// TODO[MD]: just one resize of attributes
214-
f.setFields( &mSource->mFields );
214+
f.setFields( mSource->mFields );
215215

216216
// update attributes
217217
if ( mSource->mHasEditBuffer )
@@ -297,7 +297,7 @@ void QgsVectorLayerFeatureIterator::useAddedFeature( const QgsFeature& src, QgsF
297297
{
298298
f.setFeatureId( src.id() );
299299
f.setValid( true );
300-
f.setFields( &mSource->mFields );
300+
f.setFields( mSource->mFields );
301301

302302
if ( src.constGeometry() && !( mRequest.flags() & QgsFeatureRequest::NoGeometry ) )
303303
{
@@ -381,7 +381,7 @@ void QgsVectorLayerFeatureIterator::useChangedAttributeFeature( QgsFeatureId fid
381381
{
382382
f.setFeatureId( fid );
383383
f.setValid( true );
384-
f.setFields( &mSource->mFields );
384+
f.setFields( mSource->mFields );
385385

386386
if ( !( mRequest.flags() & QgsFeatureRequest::NoGeometry ) )
387387
{

‎src/gui/qgsattributeform.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ void QgsAttributeForm::onAttributeAdded( int idx )
279279
QgsAttributes attrs = mFeature.attributes();
280280
Q_ASSERT( attrs.size() == idx );
281281
attrs.append( QVariant( layer()->pendingFields()[idx].type() ) );
282-
mFeature.setFields( &layer()->pendingFields() );
282+
mFeature.setFields( layer()->pendingFields() );
283283
mFeature.setAttributes( attrs );
284284
}
285285
init();
@@ -292,7 +292,7 @@ void QgsAttributeForm::onAttributeDeleted( int idx )
292292
{
293293
QgsAttributes attrs = mFeature.attributes();
294294
attrs.remove( idx );
295-
mFeature.setFields( &layer()->pendingFields() );
295+
mFeature.setFields( layer()->pendingFields() );
296296
mFeature.setAttributes( attrs );
297297
}
298298
init();

‎src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ bool QgsDelimitedTextFeatureIterator::nextFeatureInternal( QgsFeature& feature )
306306
// At this point the current feature values are valid
307307

308308
feature.setValid( true );
309-
feature.setFields( &mSource->mFields ); // allow name-based attribute lookups
309+
feature.setFields( mSource->mFields ); // allow name-based attribute lookups
310310
feature.setFeatureId( fid );
311311
feature.initAttributes( mSource->mFields.count() );
312312

‎src/providers/gpx/qgsgpxfeatureiterator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ bool QgsGPXFeatureIterator::readWaypoint( const QgsWaypoint& wpt, QgsFeature& fe
190190
}
191191
feature.setFeatureId( wpt.id );
192192
feature.setValid( true );
193-
feature.setFields( &mSource->mFields ); // allow name-based attribute lookups
193+
feature.setFields( mSource->mFields ); // allow name-based attribute lookups
194194
feature.initAttributes( mSource->mFields.count() );
195195

196196
readAttributes( feature, wpt );
@@ -233,7 +233,7 @@ bool QgsGPXFeatureIterator::readRoute( const QgsRoute& rte, QgsFeature& feature
233233
}
234234
feature.setFeatureId( rte.id );
235235
feature.setValid( true );
236-
feature.setFields( &mSource->mFields ); // allow name-based attribute lookups
236+
feature.setFields( mSource->mFields ); // allow name-based attribute lookups
237237
feature.initAttributes( mSource->mFields.count() );
238238

239239
readAttributes( feature, rte );
@@ -275,7 +275,7 @@ bool QgsGPXFeatureIterator::readTrack( const QgsTrack& trk, QgsFeature& feature
275275
}
276276
feature.setFeatureId( trk.id );
277277
feature.setValid( true );
278-
feature.setFields( &mSource->mFields ); // allow name-based attribute lookups
278+
feature.setFields( mSource->mFields ); // allow name-based attribute lookups
279279
feature.initAttributes( mSource->mFields.count() );
280280

281281
readAttributes( feature, trk );

‎src/providers/memory/qgsmemoryfeatureiterator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ bool QgsMemoryFeatureIterator::nextFeatureUsingList( QgsFeature& feature )
118118
close();
119119

120120
if ( hasFeature )
121-
feature.setFields( &mSource->mFields ); // allow name-based attribute lookups
121+
feature.setFields( mSource->mFields ); // allow name-based attribute lookups
122122

123123
return hasFeature;
124124
}
@@ -167,7 +167,7 @@ bool QgsMemoryFeatureIterator::nextFeatureTraverseAll( QgsFeature& feature )
167167
feature = mSelectIterator.value();
168168
++mSelectIterator;
169169
feature.setValid( true );
170-
feature.setFields( &mSource->mFields ); // allow name-based attribute lookups
170+
feature.setFields( mSource->mFields ); // allow name-based attribute lookups
171171
}
172172
else
173173
close();

‎src/providers/mssql/qgsmssqlfeatureiterator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ bool QgsMssqlFeatureIterator::fetchFeature( QgsFeature& feature )
157157
if ( mQuery->next() )
158158
{
159159
feature.initAttributes( mSource->mFields.count() );
160-
feature.setFields( &mSource->mFields ); // allow name-based attribute lookups
160+
feature.setFields( mSource->mFields ); // allow name-based attribute lookups
161161

162162
for ( int i = 0; i < mAttributesToFetch.count(); i++ )
163163
{

‎src/providers/ogr/qgsogrfeatureiterator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ bool QgsOgrFeatureIterator::readFeature( OGRFeatureH fet, QgsFeature& feature )
277277
{
278278
feature.setFeatureId( OGR_F_GetFID( fet ) );
279279
feature.initAttributes( mSource->mFields.count() );
280-
feature.setFields( &mSource->mFields ); // allow name-based attribute lookups
280+
feature.setFields( mSource->mFields ); // allow name-based attribute lookups
281281

282282
bool useIntersect = mRequest.flags() & QgsFeatureRequest::ExactIntersect;
283283
bool geometryTypeFilter = mSource->mOgrGeometryTypeFilter != wkbUnknown;

‎src/providers/postgres/qgspostgresfeatureiterator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ bool QgsPostgresFeatureIterator::fetchFeature( QgsFeature& feature )
161161
mFetched++;
162162

163163
feature.setValid( true );
164-
feature.setFields( &mSource->mFields ); // allow name-based attribute lookups
164+
feature.setFields( mSource->mFields ); // allow name-based attribute lookups
165165

166166
return true;
167167
}

‎src/providers/spatialite/qgsspatialitefeatureiterator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ bool QgsSpatiaLiteFeatureIterator::getFeature( sqlite3_stmt *stmt, QgsFeature &f
312312
}
313313

314314
feature.initAttributes( mSource->mFields.count() );
315-
feature.setFields( &mSource->mFields ); // allow name-based attribute lookups
315+
feature.setFields( mSource->mFields ); // allow name-based attribute lookups
316316

317317
int ic;
318318
int n_columns = sqlite3_column_count( stmt );

‎src/providers/wfs/qgswfsfeatureiterator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void QgsWFSFeatureIterator::copyFeature( const QgsFeature* f, QgsFeature& featur
143143
//id and valid
144144
feature.setValid( true );
145145
feature.setFeatureId( f->id() );
146-
feature.setFields( &mSource->mFields ); // allow name-based attribute lookups
146+
feature.setFields( mSource->mFields ); // allow name-based attribute lookups
147147
}
148148

149149

‎tests/src/core/testqgsexpression.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ class TestQgsExpression: public QObject
596596
QgsFields fields;
597597
fields.append( QgsField( "col1" ) );
598598
fields.append( QgsField( "second_column", QVariant::Int ) );
599-
f.setFields( &fields, true );
599+
f.setFields( fields, true );
600600
f.setAttribute( QString( "col1" ), QString( "test value" ) );
601601
f.setAttribute( QString( "second_column" ), 5 );
602602
QgsExpression exp( "attribute($currentfeature,'col1')" );

‎tests/src/core/testqgsfeature.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,14 @@ void TestQgsFeature::geometry()
257257
QCOMPARE( *feature.constGeometry()->asWkb(), *mGeometry.data()->asWkb() );
258258

259259
//geometryAndOwnership
260+
Q_NOWARN_DEPRECATED_PUSH
260261
copy = feature;
261262
QCOMPARE( *copy.constGeometry()->asWkb(), *mGeometry.data()->asWkb() );
262263
QgsGeometry* geom1 = copy.geometryAndOwnership();
263264
QCOMPARE( *geom1->asWkb(), *mGeometry->asWkb() );
264265
QgsGeometry* geom2 = feature.geometryAndOwnership();
265266
QCOMPARE( *geom2->asWkb(), *mGeometry->asWkb() );
267+
Q_NOWARN_DEPRECATED_POP
266268
delete geom1;
267269
delete geom2;
268270
}
@@ -285,15 +287,15 @@ void TestQgsFeature::fields()
285287
{
286288
QgsFeature original;
287289
QVERIFY( original.fields()->isEmpty() );
288-
original.setFields( &mFields );
290+
original.setFields( mFields );
289291
QCOMPARE( *original.fields(), mFields );
290292
QgsFeature copy( original );
291293
QCOMPARE( *copy.fields(), *original.fields() );
292294

293295
//test detach
294296
QgsFields newFields( mFields );
295297
newFields.remove( 2 );
296-
copy.setFields( &newFields );
298+
copy.setFields( newFields );
297299
QCOMPARE( *copy.fields(), newFields );
298300
QCOMPARE( *original.fields(), mFields );
299301

@@ -303,7 +305,7 @@ void TestQgsFeature::fields()
303305
copy.setAttribute( 0, 1 );
304306
copy.setAttribute( 1, 2 );
305307
copy.setAttribute( 2, 3 );
306-
copy.setFields( &mFields, false );
308+
copy.setFields( mFields, false );
307309
QCOMPARE( *copy.fields(), mFields );
308310
//should be 3 invalid attributes
309311
QCOMPARE( copy.attributes().count(), 3 );
@@ -317,7 +319,7 @@ void TestQgsFeature::fields()
317319
copy.setAttribute( 0, 1 );
318320
copy.setAttribute( 1, 2 );
319321
copy.setAttribute( 2, 3 );
320-
copy.setFields( &mFields, true );
322+
copy.setFields( mFields, true );
321323
QCOMPARE( *copy.fields(), mFields );
322324
//should be 3 invalid attributes
323325
QCOMPARE( copy.attributes().count(), 3 );
@@ -328,7 +330,7 @@ void TestQgsFeature::fields()
328330

329331
//test fieldNameIndex
330332
copy = original;
331-
copy.setFields( &mFields );
333+
copy.setFields( mFields );
332334
QCOMPARE( copy.fieldNameIndex( "bad" ), -1 );
333335
QCOMPARE( copy.fieldNameIndex( "field1" ), 0 );
334336
QCOMPARE( copy.fieldNameIndex( "field2" ), 1 );
@@ -337,7 +339,7 @@ void TestQgsFeature::fields()
337339
void TestQgsFeature::attributeUsingField()
338340
{
339341
QgsFeature feature;
340-
feature.setFields( &mFields, true );
342+
feature.setFields( mFields, true );
341343
feature.setAttribute( 0, QString( "attr1" ) );
342344
feature.setAttribute( 1, QString( "attr2" ) );
343345
feature.setAttribute( 2, QString( "attr3" ) );

0 commit comments

Comments
 (0)
Please sign in to comment.