Skip to content

Commit

Permalink
[processing] support more field types
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Jun 27, 2016
1 parent 7b1ee07 commit 1b60b08
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/qgis/ConvexHull.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def processAlgorithm(self, progress):
if useField:
index = layer.fieldNameIndex(fieldName)
fType = layer.pendingFields()[index].type()
if fType == QVariant.Int:
f.setType(QVariant.Int)
if fType in [QVariant.Int, QVariant.UInt, QVariant.LongLong, QVariant.ULongLong]:
f.setType(fType)
f.setLength(20)
elif fType == QVariant.Double:
f.setType(QVariant.Double)
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/ExtractByAttribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def processAlgorithm(self, progress):
raise GeoAlgorithmExecutionException(
self.tr('Operators %s can be used only with string fields.' % op))

if fieldType in [QVariant.Int, QVariant.Double]:
if fieldType in [QVariant.Int, QVariant.Double, QVariant.UInt, QVariant.LongLong, QVariant.ULongLong]:
expr = '"%s" %s %s' % (fieldName, operator, value)
elif fieldType == QVariant.String:
if operator not in self.OPERATORS[-2:]:
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/Merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def processAlgorithm(self, progress):
sattributes = feature.attributes()
dattributes = []
for dindex, dfield in enumerate(fields):
if (dfield.type() == QVariant.Int):
if (dfield.type() == QVariant.Int, QVariant.UInt, QVariant.LongLong, QVariant.ULongLong):
dattribute = 0
elif (dfield.type() == QVariant.Double):
dattribute = 0.0
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/SelectByAttribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def processAlgorithm(self, progress):
raise GeoAlgorithmExecutionException(
self.tr('Operators %s can be used only with string fields.' % op))

if fieldType in [QVariant.Int, QVariant.Double]:
if fieldType in [QVariant.Int, QVariant.Double, QVariant.UInt, QVariant.LongLong, QVariant.ULongLong]:
expr = '"%s" %s %s' % (fieldName, operator, value)
elif fieldType == QVariant.String:
if operator not in self.OPERATORS[-2:]:
Expand Down

0 comments on commit 1b60b08

Please sign in to comment.