title: How to place radio button at each row in qtablewidget and allow only one row to select from group of rows?
body: <p>Below is my table :</p>
  
  <p><img src="https://i.stack.imgur.com/sBTIy.png" alt="Table"></p>
  
  <p>In the above table, i have placed the Radiobutton at each row.</p>
  
  <p>In the table, column 'field' has same values in the rows i.e startdate is present in two rows and validity is also repeating in rows. 
  What i want is to only select only one  row consisting validity from the repeating values using radio button. if user selects another value,it must deselect previously selected value. </p>
  
  <p>Below is my code:</p>
  
  <pre><code>class Window(QtGui.QWidget):
      def __init__(self, data):
          QtGui.QWidget.__init__(self)
          self.data=data
          rows=len(data)
  
          data1=list()
  
          for d in data:
              #print d
              #print "ddddddddddddddd",type(d)
  
              d=d.replace('null','""')
  
              d=eval(d)
  
              #print type(d)
              data1.append(d)
          self.data1=data1
          key_list=['file','field','content','refined_content','page_number']
          data2=list()
          for line in data1:
              #print line
              d = OrderedDict((k, line[k]) for k in key_list)
              data2.append(d)
          #print data2
          data1=data2
          #print data1
  
          keys = ['file','field','content','refined_content','page_number']
  
          keys=list(keys)
  
          columns=len(keys)+1
  
  
  
          keys.append("checkbox")
  
  
          self.table = QtGui.QTableWidget(rows, columns, self)
          self.table.setHorizontalHeaderLabels(keys) 
  
  
          self.keys=keys
          #print "total columns",columns
          #print "total rows",rows
          #columns=str(columns)
  
          for column in range(columns-1):
              for row in range(rows):
                  qwidget = QtGui.QWidget()
  
  
                  checkbox = QtGui.QRadioButton()
                  checkbox.setChecked(False)
  
                  qhboxlayout = QtGui.QHBoxLayout(qwidget)
                  qhboxlayout.addWidget(checkbox)
                  qhboxlayout.setAlignment(Qt.AlignCenter)
                  qhboxlayout.setContentsMargins(0, 0, 0, 0)
                  dic=data1[row]
                  #print dic
  
                  index=int(column)
                  #print "index",index
                  value = dic.values()[index]
                  #print "current row",row
                  #print "current column",column
                  self.table.setItem(row, column, QtGui.QTableWidgetItem(str(value)))
                  #self.table.setItem(row, columns+1, QtGui.QTableWidgetItem(str(row)))
                  self.table.setCellWidget(row,columns-1 , qwidget)
  
          layout = QtGui.QVBoxLayout(self)
          self.button = QtGui.QPushButton()
          self.button.setObjectName("loadButton")
          self.button.setFixedWidth(100)
          self.button.setFixedHeight(30)
          self.button.setStyleSheet('color: white;background-color:rgb(0, 76, 153);border-style: outset;border-width: 2px;border-color: rgb(0, 76, 153);border-radius: 10px;alignment:left;')
  
          self.button.setText("Submit")
  
          layout.addWidget(self.table)
          layout.addWidget(self.button)
          self.button.clicked.connect(self.ButtonClicked)
  
  
      def ButtonClicked(self,c):
          c=self.table.columnCount()
  
          #print "c",c
          #print "keys",self.keys
          checked_list = []
          for i in range(self.table.rowCount()):
              #checked_list = []
              dic={}
              if self.table.cellWidget(i, c-1).findChild(type(QtGui.QRadioButton())).isChecked():
                  for j in range(c-1):
  
                      st=str(self.table.item(i, j).text())
                      #print j,st
                      dic[self.keys[j]]=st
                      #checked_list.append(st)
                  #print "ddiic",dic
                  checked_list.append(dic)
          print checked_list
  </code></pre>