Skip to content

Commit 18520d0

Browse files
nirvngithub-actions[bot]
authored andcommitted
Revert remaining obsolete QVariantList properties
1 parent 9fee83b commit 18520d0

8 files changed

Lines changed: 9 additions & 124 deletions

src/core/featuremodel.cpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -126,36 +126,6 @@ void FeatureModel::setFeatures( const QList<QgsFeature> &features )
126126
endResetModel();
127127
}
128128

129-
QVariantList FeatureModel::featuresVariant() const
130-
{
131-
QVariantList featuresVariant;
132-
133-
featuresVariant.reserve( mFeatures.size() );
134-
for ( const QgsFeature &feature : mFeatures )
135-
{
136-
// Pack the custom QgsFeature object into a QVariant safely
137-
featuresVariant.append( QVariant::fromValue( feature ) );
138-
}
139-
140-
return featuresVariant;
141-
}
142-
143-
void FeatureModel::setFeaturesVariant( const QVariantList &features )
144-
{
145-
QList<QgsFeature> featuresList;
146-
featuresList.reserve( features.size() );
147-
148-
for ( const QVariant &variant : features )
149-
{
150-
if ( variant.canConvert<QgsFeature>() )
151-
{
152-
featuresList.append( variant.value<QgsFeature>() );
153-
}
154-
}
155-
156-
setFeatures( featuresList );
157-
}
158-
159129
void FeatureModel::setCurrentLayer( QgsVectorLayer *layer )
160130
{
161131
if ( layer == mLayer )

src/core/featuremodel.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class FeatureModel : public QAbstractListModel
3535
Q_OBJECT
3636
Q_PROPERTY( FeatureModel::ModelModes modelMode READ modelMode WRITE setModelMode NOTIFY modelModeChanged )
3737
Q_PROPERTY( QgsFeature feature READ feature WRITE setFeature NOTIFY featureChanged )
38-
Q_PROPERTY( QVariantList features READ featuresVariant WRITE setFeaturesVariant NOTIFY featuresChanged )
38+
Q_PROPERTY( QList<QgsFeature> features READ features WRITE setFeatures NOTIFY featuresChanged )
3939
Q_PROPERTY( QgsFeature linkedParentFeature READ linkedParentFeature WRITE setLinkedParentFeature NOTIFY linkedParentFeatureChanged )
4040
Q_PROPERTY( QgsRelation linkedRelation READ linkedRelation WRITE setLinkedRelation NOTIFY linkedRelationChanged )
4141
Q_PROPERTY( QString linkedRelationOrderingField READ linkedRelationOrderingField WRITE setLinkedRelationOrderingField NOTIFY linkedRelationOrderingFieldChanged )
@@ -84,17 +84,10 @@ class FeatureModel : public QAbstractListModel
8484

8585
void setFeature( const QgsFeature &feature );
8686

87-
/**
88-
* Return the feature wrapped in a QVariant for passing it around in QML
89-
*/
9087
QgsFeature feature() const;
9188

9289
void setFeatures( const QList<QgsFeature> &features );
9390

94-
QVariantList featuresVariant() const;
95-
96-
void setFeaturesVariant( const QVariantList &features );
97-
9891
/**
9992
* Return the features list for passing it around in QML
10093
*/

src/core/multifeaturelistmodel.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -219,21 +219,6 @@ QList<QgsFeature> MultiFeatureListModel::selectedFeatures()
219219
return mSourceModel->selectedFeatures();
220220
}
221221

222-
QVariantList MultiFeatureListModel::selectedFeaturesVariant()
223-
{
224-
QVariantList featuresVariant;
225-
const QList<QgsFeature> features = mSourceModel->selectedFeatures();
226-
227-
featuresVariant.reserve( features.size() );
228-
for ( const QgsFeature &feature : features )
229-
{
230-
// Pack the custom QgsFeature object into a QVariant safely
231-
featuresVariant.append( QVariant::fromValue( feature ) );
232-
}
233-
234-
return featuresVariant;
235-
}
236-
237222
QgsVectorLayer *MultiFeatureListModel::selectedLayer()
238223
{
239224
return mFilterLayer.data();

src/core/multifeaturelistmodel.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class MultiFeatureListModel : public QSortFilterProxyModel
3333
Q_OBJECT
3434

3535
Q_PROPERTY( int count READ count NOTIFY countChanged )
36-
Q_PROPERTY( QVariantList selectedFeatures READ selectedFeaturesVariant NOTIFY selectedCountChanged )
36+
Q_PROPERTY( QList<QgsFeature> selectedFeatures READ selectedFeatures NOTIFY selectedCountChanged )
3737
Q_PROPERTY( QgsVectorLayer *selectedLayer READ selectedLayer NOTIFY selectedLayerChanged )
3838
Q_PROPERTY( int selectedCount READ selectedCount NOTIFY selectedCountChanged )
3939
Q_PROPERTY( bool canEditAttributesSelection READ canEditAttributesSelection NOTIFY selectedCountChanged )
@@ -175,11 +175,6 @@ class MultiFeatureListModel : public QSortFilterProxyModel
175175
*/
176176
QList<QgsFeature> selectedFeatures();
177177

178-
/**
179-
* Returns the list of currently selected features as a QVariantList object.
180-
*/
181-
QVariantList selectedFeaturesVariant();
182-
183178
/**
184179
* Returns the vector layer within which one or more features are currently selected
185180
*/

src/core/processing/processingalgorithm.cpp

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -91,36 +91,6 @@ void ProcessingAlgorithm::setInPlaceFeatures( const QList<QgsFeature> &features
9191
}
9292
}
9393

94-
QVariantList ProcessingAlgorithm::inPlaceFeaturesVariant() const
95-
{
96-
QVariantList featuresVariant;
97-
98-
featuresVariant.reserve( mInPlaceFeatures.size() );
99-
for ( const QgsFeature &feature : mInPlaceFeatures )
100-
{
101-
// Pack the custom QgsFeature object into a QVariant safely
102-
featuresVariant.append( QVariant::fromValue( feature ) );
103-
}
104-
105-
return featuresVariant;
106-
}
107-
108-
void ProcessingAlgorithm::setInPlaceFeaturesVariant( const QVariantList &features )
109-
{
110-
QList<QgsFeature> featuresList;
111-
featuresList.reserve( features.size() );
112-
113-
for ( const QVariant &variant : features )
114-
{
115-
if ( variant.canConvert<QgsFeature>() )
116-
{
117-
featuresList.append( variant.value<QgsFeature>() );
118-
}
119-
}
120-
121-
setInPlaceFeatures( featuresList );
122-
}
123-
12494
void ProcessingAlgorithm::setParameters( const QVariantMap &parameters )
12595
{
12696
if ( mAlgorithmParameters == parameters )
@@ -235,7 +205,7 @@ bool ProcessingAlgorithm::run( bool previewMode )
235205
{
236206
for ( const QgsFeature &outputFeature : outputFeatures )
237207
{
238-
mPreviewGeometries << QVariant::fromValue( outputFeature.geometry() );
208+
mPreviewGeometries << outputFeature.geometry();
239209
}
240210

241211
emit previewGeometriesChanged();
@@ -326,7 +296,7 @@ bool ProcessingAlgorithm::run( bool previewMode )
326296
{
327297
for ( const QgsFeature &previewFeature : outputFeatures )
328298
{
329-
mPreviewGeometries << QVariant::fromValue( previewFeature.geometry() );
299+
mPreviewGeometries << previewFeature.geometry();
330300
}
331301

332302
emit previewGeometriesChanged();

src/core/processing/processingalgorithm.h

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ class ProcessingAlgorithm : public QObject
4545

4646
Q_PROPERTY( QVariantMap parameters READ parameters WRITE setParameters NOTIFY parametersChanged )
4747
Q_PROPERTY( QgsVectorLayer *inPlaceLayer READ inPlaceLayer WRITE setInPlaceLayer NOTIFY inPlaceLayerChanged )
48-
Q_PROPERTY( QVariantList inPlaceFeatures READ inPlaceFeaturesVariant WRITE setInPlaceFeaturesVariant NOTIFY inPlaceFeaturesChanged )
48+
Q_PROPERTY( QList<QgsFeature> inPlaceFeatures READ inPlaceFeatures WRITE setInPlaceFeatures NOTIFY inPlaceFeaturesChanged )
4949

5050
Q_PROPERTY( bool preview READ preview WRITE setPreview NOTIFY previewChanged )
51-
Q_PROPERTY( QVariantList previewGeometries READ previewGeometries NOTIFY previewGeometriesChanged )
51+
Q_PROPERTY( QList<QgsGeometry> previewGeometries READ previewGeometries NOTIFY previewGeometriesChanged )
5252

5353
public:
5454
explicit ProcessingAlgorithm( QObject *parent = nullptr );
@@ -98,16 +98,6 @@ class ProcessingAlgorithm : public QObject
9898
*/
9999
void setInPlaceFeatures( const QList<QgsFeature> &features );
100100

101-
/**
102-
* Returns the vector \a layer for in-place algorithm filter as a QVariantList.
103-
*/
104-
QVariantList inPlaceFeaturesVariant() const;
105-
106-
/**
107-
* Sets the vector \a layer for in-place algorithm filter from a QVariantList.
108-
*/
109-
void setInPlaceFeaturesVariant( const QVariantList &features );
110-
111101
/**
112102
* Returns the algorithm parameters as a map of parameter names as keys and values.
113103
*/
@@ -133,7 +123,7 @@ class ProcessingAlgorithm : public QObject
133123
/**
134124
* Returns a list of geometries previewing the algorithm result using current parameters.
135125
*/
136-
QVariantList previewGeometries() const { return mPreviewGeometries; }
126+
QList<QgsGeometry> previewGeometries() const { return mPreviewGeometries; }
137127

138128
/**
139129
* Executes the algorithm.
@@ -180,7 +170,7 @@ class ProcessingAlgorithm : public QObject
180170
QList<QgsFeature> mInPlaceFeatures;
181171

182172
bool mPreview = false;
183-
QVariantList mPreviewGeometries;
173+
QList<QgsGeometry> mPreviewGeometries;
184174
};
185175

186176
#endif // PROCESSINGALGORITHM

src/core/trackingmodel.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,6 @@ bool TrackingModel::featureInTracking( QgsVectorLayer *layer, const QgsFeatureId
102102
return false;
103103
}
104104

105-
bool TrackingModel::featuresInTracking( QgsVectorLayer *layer, const QVariantList &features )
106-
{
107-
QList<QgsFeature> featuresList;
108-
109-
featuresList.reserve( features.size() );
110-
for ( const QVariant &variant : features )
111-
{
112-
if ( variant.canConvert<QgsFeature>() )
113-
{
114-
featuresList.append( variant.value<QgsFeature>() );
115-
}
116-
}
117-
118-
return featuresInTracking( layer, featuresList );
119-
}
120-
121105
bool TrackingModel::featuresInTracking( QgsVectorLayer *layer, const QList<QgsFeature> &features )
122106
{
123107
auto it = trackerIterator( layer );

src/core/trackingmodel.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ class TrackingModel : public QAbstractItemModel
6464
//! Returns TRUE if the \a featureId is attached to a vector \a layer tracking session.
6565
Q_INVOKABLE bool featureInTracking( QgsVectorLayer *layer, QgsFeatureId featureId );
6666
//! Returns TRUE if the list of \a features is attached to a vector \a layer tracking session.
67-
Q_INVOKABLE bool featuresInTracking( QgsVectorLayer *layer, const QVariantList &features );
68-
//! Returns TRUE if the list of \a features is attached to a vector \a layer tracking session.
69-
bool featuresInTracking( QgsVectorLayer *layer, const QList<QgsFeature> &features );
67+
Q_INVOKABLE bool featuresInTracking( QgsVectorLayer *layer, const QList<QgsFeature> &features );
7068
//! Returns TRUE if the vector \a layer has a tracking session.
7169
Q_INVOKABLE bool layerInTracking( QgsVectorLayer *layer ) const;
7270
//! Returns TRUE if the vector \a layer has an active tracking session.

0 commit comments

Comments
 (0)