title: Add buttons to a table using "table View"
body: <p>I am trying to add '<strong>Share</strong>' and '<strong>Delete</strong>' buttons to each row of the table using "<strong>table View</strong>" class of PySide. </p>
  
  <p>But I am unable to do since I don't have much knowledge of PySide. Can any one please guide me how to add buttons to table view.</p>
  
  <p><strong>Expected Output:</strong>
  <a href="https://i.stack.imgur.com/aRmY0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aRmY0.png" alt="Expected Output"></a></p>
  
  <p><strong>My code:</strong></p>
  
  <pre><code>import sys
  import os
  import csv
  from PySide import QtGui, QtCore
  
  
  
  class Example(QtGui.QMainWindow):
      def __init__(self, parent=None):
          super(Example, self).__init__(parent)
  
          self.dirPath  = "/home/cioc/Documents/GPR/GRP"
          self.filePath = ""
          self.fileName =""
          self.lay1 = QtGui.QVBoxLayout()
          self.scrollArea = QtGui.QScrollArea()
          self.scrollArea.setBackgroundRole(QtGui.QPalette.Light)
          self.scrollArea.setWidgetResizable(True)
          self.mainLayout =QtGui. QGridLayout()
  
          self.mainLayout.addWidget(self.scrollArea,0,1)
  
          self.setCentralWidget(QtGui.QWidget(self))
          self.centralWidget().setLayout(self.mainLayout)
          self.setGeometry(100,100,800,500)
  
          self.w = QtGui.QWidget()
          self.lay = QtGui.QVBoxLayout()
          self.model  =QtGui. QStandardItemModel(self)
          self.tableView = QtGui.QTableView(self)
          self.tableView.setModel(self.model)
          self.tableView.horizontalHeader().setStretchLastSection(True)
          self.tableView.clicked[QtCore.QModelIndex].connect(self.onClick)
          self.tableView.verticalHeader().setVisible(False)
          self.appendRowItems(self.dirPath)
          self.lay.addWidget(self.tableView)
          self.w.setLayout(self.lay)
          self.scrollArea.setWidget(self.w)
  
          # self.btn_sell = QtGui.QPushButton('Delete')
          # self.btn_sell.clicked.connect(self.delete)
      def appendRowItems(self, dir):
          for root, dirs, files in os.walk(dir):
              if root == dir:
                  for file in files:
                      self.model.appendRow(QtGui.QStandardItem(file))
  
      # def delete(self,index):
          # self.model.clear()
  
      def onClick(self, ind):
          self.filePath = self.dirPath +"/"+ self.model.item(ind.row(), ind.column()).text()
  
          print(self.filePath)
  
  
  if __name__ == '__main__':
      app = QtGui.QApplication(sys.argv)
      eg =  Example()
      eg.show()
      app.exec_()
  </code></pre>