Skip to content

Commit

Permalink
Merge pull request #1897 from arnaud-morvan/fix_fieldsmapper
Browse files Browse the repository at this point in the history
[processing] Fix fieldsmapper
  • Loading branch information
volaya committed Feb 12, 2015
2 parents b26556e + 3c93827 commit 7a0d041
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions python/plugins/processing/algs/qgis/ui/FieldsMappingPanel.py
Expand Up @@ -132,7 +132,7 @@ def data(self, index, role=QtCore.Qt.DisplayRole):

fieldType = column_def['type']
if fieldType == QtCore.QVariant.Type:
if value == 0:
if value == QtCore.QVariant.Invalid:
return ''
return self.fieldTypes[value]
return value
Expand Down Expand Up @@ -243,7 +243,7 @@ def createEditor(self, parent, option, index):
elif fieldType == QgsExpression:
editor = QgsFieldExpressionWidget(parent)
editor.setLayer(index.model().layer())
# editor.fieldChanged.connect(self.on_expression_fieldChange)
editor.fieldChanged.connect(self.on_expression_fieldChange)

else:
editor = QtGui.QStyledItemDelegate.createEditor(self, parent, option, index)
Expand Down Expand Up @@ -277,6 +277,8 @@ def setModelData(self, editor, model, index):
fieldType = FieldsMappingModel.columns[column]['type']
if fieldType == QtCore.QVariant.Type:
value = editor.itemData(editor.currentIndex())
if value is None:
value = QtCore.QVariant.Invalid
model.setData(index, value)

elif fieldType == QgsExpression:
Expand All @@ -289,9 +291,8 @@ def setModelData(self, editor, model, index):
def updateEditorGeometry(self, editor, option, index):
editor.setGeometry(option.rect)

def on_expression_fieldChange(self, fieldName, isValid):
# self.commitData.emit(self.sender())
pass
def on_expression_fieldChange(self, fieldName):
self.commitData.emit(self.sender())


class FieldsMappingPanel(QtGui.QWidget, Ui_Form):
Expand Down

0 comments on commit 7a0d041

Please sign in to comment.