Skip to content

Commit

Permalink
[processing] support more field types
Browse files Browse the repository at this point in the history
(cherry picked from commit 1b60b08)
  • Loading branch information
alexbruy committed Jun 27, 2016
1 parent e29eb57 commit 9b1380c
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
Expand Up @@ -70,8 +70,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
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
Expand Up @@ -92,7 +92,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
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 9b1380c

Please sign in to comment.