title: PyQt - defining signals for multiple objects in loops
body: <p>Here is my problem. I want to create <em>n</em> number of <em>QLineEdit</em> widgets (<em>n</em> can be any number, depends on the input values). I can create those <em>QLineEdit</em> widgets, give them object name and text, but I can't define signals on all of them (I want that every <em>QLineEdit</em> widget emits signal when interacting with it). Here is the example od the code:</p>
  
  <pre><code>self.fieldList = {}
  
  for (i, value) in attrMap.iteritems():
      self.fieldList["valueField" + str(i)] = QtGui.QLineEdit()
      self.fieldList["valueField" + str(i)].setObjectName(_fromUtf8("attributeValueField_{0}".format(i)))
      self.fieldList["valueField" + str(i)].setText(_fromUtf8("{0}".format(value.toString())))
      self.fieldList["valueField" + str(i)].cursorPositionChanged.connect(lambda: (self.checkState(self.fieldList["valueField" + str(i)])))
  </code></pre>
  
  <p>The problem persist in the last line:</p>
  
  <pre><code>self.fieldList["valueField" + str(i)].cursorPositionChanged.connect(lambda: (self.checkState(self.fieldList["valueField" + str(i)])))
  </code></pre>
  
  <p>I thought that signal would stick to every widget, but because of the loop, signal "jumps" from widget to the widget until it gets to the last widget so only that last widget is able to emit signal. So how can I arrange that every widget emits signal when being changed? </p>