title: PyQt4 Signal AttributeError: object has no attribute
body: <p>I've tried to strip my code down until there's almost nothing left but still can't seem to connect my <code>addButton</code> widget to my <code>self.add</code> method. I'm sure I am missing something painfully obvious but my eyes aren't catching it.. </p>
  
  <pre><code>from PyQt4.QtCore import *
  from PyQt4.QtGui import *
  import sys
  
  class StringListDlg(QDialog):
  
      def __init__(self, name, strings, parent=None):
          super(StringListDlg, self).__init__(parent)
  
          self.listWidget = QListWidget()
          self.listWidget.addItems(strings)
          addButton = QPushButton("&amp;Add...")
  
          grid = QGridLayout()
          grid.addWidget(self.listWidget, 0, 0, 7, 1)
  
          self.setLayout(grid)
          self.setWindowTitle("Edit {} List".format(name))
  
          self.connect(addButton, SIGNAL("clicked()"), self.add)
  
          def add(self):
              pass
  
  if __name__ == "__main__":
      app = QApplication(sys.argv)
      form = StringListDlg("Fruit", ['apples', 'bananas'])
      form.exec_()
  </code></pre>
  
  <p>Here's my traceback:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:/pyqt/chap05/test.py", line 27, in &lt;module&gt;
      form = StringListDlg("Fruit", ['apples', 'bananas'])
    File "C:/pyqt/chap05/test.py", line 20, in __init__
      self.connect(addButton, SIGNAL("clicked()"), self.add)
  AttributeError: 'StringListDlg' object has no attribute 'add'
  </code></pre>