0

I have tabs added dynamically to a tab widget and having the same content. I want to control actions on every tab for example a click on push button. However, I cannot distinguich between actions on a tab. For example, If I click on button on tab 1, I get that there is a button clicked but I cannot know if it is on tab 1 or on tab 2.

This is how I add my tabs dynamically :

 def add_new_tab(self,index,text):

    self.new_tab = InterfaceTemplateDialog()
    self.tabs.addTab(self.new_tab,text)
    self.tabs.setTabText(index,text)

This is the start of the class InterfaceTemplateDialog:

class InterfaceTemplateDialog(QtGui.QDialog, FORM_CLASS):

def __init__(self,parent=None):
    """Constructor."""
    super(InterfaceTemplateDialog, self).__init__(parent)

    self.setupUi(self)


    self.run_tranus_btn = self.findChild(QtGui.QPushButton,'run_tranus_btn')
    self.spin_box = self.findChild(QtGui.QSpinBox,'spinBox')

    #imploc checkboxes 
    self.checkBox_22 = self.findChild(QtGui.QCheckBox,'checkBox_22') ....etc

I know that I can get the index of the current tab using currentIndex = self.tabs.currentIndex() but my problem is with the buttons and checkboxes, how to know on which tab the action is performed.

Ammoun
  • 73
  • 2
  • 14

0 Answers0