Skip to content

Commit

Permalink
Fix type error in QgsProcessingParameterNumber in new QGIS version (#278
Browse files Browse the repository at this point in the history
)
  • Loading branch information
hoanphungt authored Nov 29, 2024
1 parent c408e0d commit 3fe7a2e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ History
1.15 (unreleased)
-----------------

- Nothing changed yet.
- Fix type error: #278


1.14 (2024-11-12)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,19 @@ def initAlgorithm(self, config=None):
)
)
storm_pref = QgsProcessingParameterNumber(
self.STORMWATER_SEWER_PREFERENCE, self.tr("Stormwater sewer preference [m]"), type=1, defaultValue=0.0
self.STORMWATER_SEWER_PREFERENCE, self.tr("Stormwater sewer preference [m]"), type=QgsProcessingParameterNumber.Double, defaultValue=0.0
)
storm_pref.setMinimum(0.0)
storm_pref.setMetadata({"widget_wrapper": {"decimals": 2}})
self.addParameter(storm_pref)
sanitary_pref = QgsProcessingParameterNumber(
self.SANITARY_SEWER_PREFERENCE, self.tr("Sanitary sewer preference [m]"), type=1, defaultValue=0.0
self.SANITARY_SEWER_PREFERENCE, self.tr("Sanitary sewer preference [m]"), type=QgsProcessingParameterNumber.Double, defaultValue=0.0
)
sanitary_pref.setMinimum(0.0)
sanitary_pref.setMetadata({"widget_wrapper": {"decimals": 2}})
self.addParameter(sanitary_pref)
search_distance = QgsProcessingParameterNumber(
self.SEARCH_DISTANCE, self.tr("Search distance"), type=1, defaultValue=10.0
self.SEARCH_DISTANCE, self.tr("Search distance"), type=QgsProcessingParameterNumber.Double, defaultValue=10.0
)
search_distance.setMinimum(0.01)
search_distance.setMetadata({"widget_wrapper": {"decimals": 2}})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def initAlgorithm(self, config=None):
)
)

offset_param = QgsProcessingParameterNumber(self.OFFSET_DISTANCE, self.tr("Distance (m)"), type=1)
offset_param = QgsProcessingParameterNumber(self.OFFSET_DISTANCE, self.tr("Distance (m)"), type=QgsProcessingParameterNumber.Double)
offset_param.setMetadata({"widget_wrapper": {"decimals": 3}})
self.addParameter(offset_param)
self.addParameter(
Expand Down

0 comments on commit 3fe7a2e

Please sign in to comment.