title: How to detect which PyQt5 QtWidgets.QPushButton was clicked?
body: <p>In PyQt5 I generate as many QPushButtons as there are items in a list, like:</p>
  
  <pre><code>self.modelsButton = [QtWidgets.QPushButton(self.resultsWidget) for x in modelsDefined]
  </code></pre>
  
  <p>And then I make them execute a function when clicked:</p>
  
  <pre><code>[self.ui.modelsButton[i].clicked.connect(self.populateDetailsTab) for i in range(len(self.modelsDefined))]
  </code></pre>
  
  <p>The function <code>populateDetailsTab</code> will attempt to pull the text details of the button clicked, but I can't decipher which button was clicked. I tried to pull the text of the button directly via the following:</p>
  
  <pre><code>[self.ui.modelsButton[i].clicked.connect(self.populateDetailsTab(self.ui.modelsButton[i].text().split[0])) for i in range(len(self.modelsDefined))]
  </code></pre>
  
  <p>But this throws an error: <code>TypeError: 'builtin_function_or_method' object is not subscriptable</code>.</p>
  
  <p>Can someone please help me identify which button was clicked? There are a decent number of buttons generated in my script.</p>