I want to update some fields from a selected feature in an edit session with some values provided by a form made in QtDesigner. The fields have indexes 0 and 2.
Tried so far:
from edit_Form import Ui_EditForm
class editForm(QtGui.QDialog):
def __init__(self):
QtGui.QDialog.__init__(self)
self.ui = Ui_EditForm()
self.ui.setupUi(self)
self.ui.pushButton.clicked.connect(self.accept)
def accept(self):
for i in iface.activeLayer().selectedFeatures():
fid = i.id()
provider = iface.activeLayer().dataProvider()
name = iface.activeLayer().fieldNameIndex("NAME")
siruta = iface.activeLayer().fieldNameIndex("SIRUTA")
textNAME = self.ui.NAME.text()
textSIRUTA = self.ui.SIRUTA.text()
i.setAttribute(0,self.ui.NAME.text() )
i.setAttribute(2,self.ui.SIRUTA.text())