title: How to get plain text from a cell QTableView
body: <p>I'm trying to do a drag and drop between two items, but I'm having trouble getting the information out of the cell I click on in the table. I have a custom table that has a custom model.</p>
  <pre class="lang-py prettyprint-override"><code>class PyTableWidget(QTableView):
      def __init__(self, *args):
          super().__init__()
          self.setDragEnabled(True)
  
          self.set_stylesheet(*args)
  
      def onLeftClick(self, index):
                  print('onClick index.row: %s, index.col: %s' % (index.row(), index.column()))
  
      def mouseMoveEvent(self, event):
          if event.buttons() == Qt.LeftButton:
              drag = QDrag(self)
              mime = QMimeData()
              drag.setMimeData(mime)
              drag.exec(Qt.MoveAction)
  </code></pre>
  <p>Here's the custom model for the table:</p>
  <pre class="lang-py prettyprint-override"><code>class CustomizedNumpyModel(QAbstractTableModel):
      def __init__(self, data, parent=None):
          QAbstractTableModel.__init__(self, parent)
          self._data = np.array(data.values)
          self._cols = data.columns
          self.r, self.c = np.shape(self._data)
  
      def data(self, index, role=Qt.DisplayRole):
  
          if role == Qt.DisplayRole:
              value = self._data[index.row(), index.column()]
  
              if isinstance(value, float):
                  return &quot;%.2f&quot; % value
  
              if isinstance(value, str):
                  return '%s' % value
  
              return unicode(value)
  
      def rowCount(self, parent=None):
          return self.r
  
      def columnCount(self, parent=None):
          return self.c
  
      def headerData(self, p_int, orientation, role):
          if role == Qt.DisplayRole:
              if orientation == Qt.Horizontal:
                  return str(self._cols[p_int])
  
              if orientation == Qt.Vertical:
                  return p_int
          return None
  
      def flags(self, index):
          return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsEditable
  
      def setData(self, index, value, role=Qt.EditRole):
          index_value = None
          based_columns = [6, 8, 10, 12]
          if role == Qt.EditRole:
              row = index.row()
              column = index.column()
              tmp = str(value)
              if tmp != '':
                  if column in based_columns:
                      if column == 6 and tmp in self._cols:
                          index_no = np.where(self._cols == tmp)[0][0]
                          self._data[row, column + 1] = self._data[row, index_no]
                          self._data[row, column] = tmp
                      elif column in [8, 10, 12]:
                          for x in range(97, 181):
                              if self._data[row, x] == int(tmp):
                                  index_value = x
                                  break
  
                          col_name = self._cols[index_value]
                          col_name = col_name.removesuffix('_rank')
                          self._data[row, column + 1] = col_name
                          self._data[row, column] = tmp
                      self.dataChanged.emit(index, index)
                  return True
              else:
                  return False
  
  </code></pre>
  <p>And here the code in the other widget which accept the drop</p>
  <pre class="lang-py prettyprint-override"><code>class PyCustomButton(QPushButton):
      def __init__(self, *args):
          super().__init__()
          self.setCursor(Qt.PointingHandCursor)
          self.setAcceptsDrops(True)
          self._lista = []
  
      def dragEnterEvent(self, event):
          if event.mimeData().hasText():
              event.accept()
          else:
              event.ignore()
  
      def dropEvent(self, event):
          self._lista.append(event.mimeData().text())
          print(self._lista)
  </code></pre>
  <p>The table has following aspect:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Names</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>First</td>
  </tr>
  <tr>
  <td>Second</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>And I want plain text i.e. <code>First</code> or <code>Second</code> drag from table and drop in custom button.</p>