Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[processing] Fix deprecated QgsField constructor and use QMetaType.Type in place of QVariant in various qgis: algorithms (Fix #57920) #58756

Merged

Conversation

agiudiceandrea
Copy link
Member

@agiudiceandrea agiudiceandrea commented Sep 15, 2024

Description

Fixes #57920 for various processing algorithms:

"Check validity" qgis:checkvalidity
"Climb along line" qgis:climbalongline
"Add geometry attributes" qgis:exportaddgeometrycolumns
"Advanced Python field calculator" qgis:advancedpythonfieldcalculator
"Find projection" qgis:findprojection
"Distance to nearest hub (line to hub)" qgis:distancetonearesthublinetohub
"Distance to nearest hub (points)" qgis:distancetonearesthubpoints
"Concave hull (k-nearest neighbor)" qgis:knearestconcavehull
"Minimum bounding geometry" qgis:minimumboundinggeometry
"Distance matrix" qgis:distancematrix
"Generate points (pixel centroids) along line" qgis:generatepointspixelcentroidsalongline
"Random points along line" qgis:randompointsalongline
"Random points in layer bounds" qgis:randompointsinlayerbounds
"Random points inside polygons" qgis:randompointsinsidepolygons
"Regular points" qgis:regularpoints
"Statistics by categories" qgis:statisticsbycategories
"Text to float" qgis:texttofloat
"Topological coloring" qgis:topologicalcoloring

"Select by attribute" qgis:selectbyattribute was also updated to use QMetaType.Type in place of QVariant, although not used in a QgsField constructor.

Not to be backported to 3.34.

Ref: #57272.

Side note: while fixing the code of the "Advanced Python field calculator" algorithm I noticed that, years ago, there was a shift from Int to LongLong field type 0ac0249 (#5143) by @m-kuhn, but more recently the field type has been reverted to Int from LongLong 835fe14 (#47094) by @nirvn. Is it intentional or an oversight?

Using QMetaType.Type in place of QVariant types for:
- "Check validity" qgis:checkvalidity
- "Climb along line" qgis:climbalongline
- "Add geometry attributes" qgis:exportaddgeometrycolumns
- "Advanced Python field calculator" qgis:advancedpythonfieldcalculator
- "Find projection" qgis:findprojection
- "Distance to nearest hub (line to hub)" qgis:distancetonearesthublinetohub
- "Distance to nearest hub (points)"  qgis:distancetonearesthubpoints
- "Concave hull (k-nearest neighbor)" qgis:knearestconcavehull
- "Minimum bounding geometry" qgis:minimumboundinggeometry
- "Distance matrix" qgis:distancematrix
- "Generate points (pixel centroids) along line" qgis:generatepointspixelcentroidsalongline
- "Random points along line" qgis:randompointsalongline
- "Random points in layer bounds" qgis:randompointsinlayerbounds
- "Random points inside polygons" qgis:randompointsinsidepolygons
- "Regular points" qgis:regularpoints
- "Statistics by categories" qgis:statisticsbycategories
- "Text to float" qgis:texttofloat
- "Topological coloring" qgis:topologicalcoloring
QgsField.type() returns QMetaType.Type
@github-actions github-actions bot added this to the 3.40.0 milestone Sep 15, 2024
Copy link

🪟 Windows builds ready!

Windows builds of this PR are available for testing here. Debug symbols for this build are available here.

(Built from commit 7f9704d)

@nyalldawson nyalldawson merged commit ab611a9 into qgis:master Sep 15, 2024
32 checks passed
@agiudiceandrea agiudiceandrea deleted the fix-57920-deprecated-qgsfield-qvariant branch September 16, 2024 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Processing] Various algorithms: "DeprecationWarning: QgsField constructor is deprecated"
2 participants