title: How to set data to QComboBox using QAbstractTableModel (Model/View)?
body: <p>I wish to be able to set the <code>itemData</code> of a <code>combobox</code> when populated using a <code>QAbstractTableModel</code>. However, I can only return one string from the model's <code>data</code> method.</p>
  
  <p>Usually, when not using a model, this can be performed like so:</p>
  
  <pre><code># Set text and data
  combobox.addItem('Some text', 'some item data')
  
  # Retrieve data from selected
  item_data = combobox.itemData(combobox.currentIndex())
  </code></pre>
  
  <p><strong>How can this be done, but using <code>QAbstractTableModel</code>?</strong></p>
  
  <hr>
  
  <p>I have a <code>combobox</code>, which I set a model to:</p>
  
  <pre><code>model = ProjectTableModel(projects)
  combobox.setModel(model)
  </code></pre>
  
  <p>My model:</p>
  
  <pre><code>class ProjectTableModel(QtCore.QAbstractTableModel):
  
      def __init__(self, projects=[], parent=None):
          QtCore.QAbstractTableModel.__init__(self, parent)
          self._projects = projects
  
      def rowCount(self, parent):
          return len(self._projects)
  
      def columnCount(self, parent):
          return 2
  
      def data(self, index, role):
          row = index.row()
          column = index.column()
  
          if role == QtCore.Qt.DisplayRole and column == 0:
              project = self._projects[row]
              name = project.name()
              id = project.id()  # &lt;----- how to add this as itemData?
              return name
  </code></pre>