title: How to see signals from QWidgets inside dynamically created QTabWidget pages?
body: <p>EDIT : I've come up with a solution, and it's much more straightforward than I thought. Original code and question at the top. My solution after "The Question" below..</p>
  
  <h1>The Example</h1>
  
  <pre><code>from PyQt4 import QtGui, QtCore
  from example_Ui import Ui_MainWindow
  from filler_Ui import Form
  
  
  class TabFiller(Form):
      def __init__(self, parent=None):
          Form.__init__(self, parent)
  
      def TabButtonClicked(self):
          print("Tab button pressed.")
  
      def LineEditChanged(self):
          print("LineEdit contents edited in tab page!")
  
  
  class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
      def __init__(self, parent=None):
          super(MainWindow, self).__init__(parent)
          self.setupUi(self)
  
      tab_filler = [] # create empty list for tab contents
      tab_page = [] # create empty list for tab page
      tab_count = 0
  
      def CreateNewTab(self):
          tab_title = "New Tab : " + str(self.tab_count)
          self.tab_filler.append(TabFiller())
          self.tab_filler[self.tab_count].label.setText(tab_title)
          self.tab_page.append(self.tab_filler[self.tab_count])
          self.tabWidget.addTab(self.tab_page[self.tab_count], tab_title)
          self.tab_count += 1
  
      def MainButtonPressed(self):
          self.CreateNewTab()
  
  if __name__ == '__main__':
      import sys
      app = QtGui.QApplication(sys.argv)
      window = MainWindow()
      window.show()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>MainWindow contains a QTabWidget, which is a Button. clicked() signal has been defined in QtDesigner to be sent to the MainButtonPressed() function inside the MainWindow class.</p>
  
  <p>Form widget also created in QTdesigner. Used to fill additional Tab Pages.
  This contains a Button widget, and a LineEdit Widget.</p>
  
  <h1>The Question</h1>
  
  <p>I can't get my head around <em>how</em> I can tell <em>which</em> widget has been clicked or edited in <em>each</em> tab.</p>
  
  <p>I know that each Tab Page is stored in the <strong>list</strong> called <strong>tab_page</strong>.</p>
  
  <p>Within the MainWindow class, how would I receive a clicked() or finishedEditing() signal for a given widget in a currently active tab?</p>
  
  <h1>A Solution</h1>
  
  <pre><code>import sys
  from PyQt4.QtGui import *
  from PyQt4.QtCore import *
  from PyQt4 import QtGui
  from example_Ui import Ui_MainWindow
  from filler_Ui import Form
  
  class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
      def __init__(self, parent=None):
          super(MainWindow, self).__init__(parent)
          self.setupUi(self)
  
      tab_index = 1 # 1 because we already made a default tab in QtDesigner
  
      def LineEditChanged(self):
          findWidget = self.tabWidget.widget(self.tabWidget.currentIndex()).findChildren(QtGui.QLineEdit, "lineEdit")
          if findWidget[0].isModified() == True:
              print("LineEdit contents edited in tab page!")
              print("Name of page edited :", "'", self.tabWidget.tabText(self.tabWidget.currentIndex()),"'")
  
      def TabButtonPressed(self):
          print("YOU DID IT!")
          print("Current Tab Index = ", self.tabWidget.currentIndex())
  
      def CreateNewTab(self, tabNum):
          tab_title = "New Tab : " + str(self.tab_index)
          self.tabWidget.addTab(Form(), tab_title)
  
      def MainButtonPressed(self):
          self.CreateNewTab(self.tab_index)
          findWidget = self.tabWidget.widget(self.tab_index).findChildren(QtGui.QPushButton, "tabButton")
          findWidget[0].clicked.connect(self.TabButtonPressed)
          findWidget = self.tabWidget.widget(self.tab_index).findChildren(QtGui.QLineEdit, "lineEdit")
          findWidget[0].editingFinished.connect(self.LineEditChanged)
          self.tab_index += 1
  
  if __name__ == '__main__':
      app = QtGui.QApplication(sys.argv)
      window = MainWindow()
      window.show()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>Using this there's no need for storing each tab page object in a list. You basically use the QTabWidget to index your pages, and off you go.</p>
  
  <p>If anyone has a more elegant way than this, please inform ;)</p>