title: Enable/Disable QPushButton upon row selection in QTableWidget
body: <p>I have a QTableWidget and a Delete QPushButton.</p>
  
  <p>I want the delete button to be enabled only when a row is selected from QTableWidget and if no row is selected then button should be disabled. </p>
  
  <p>While initialization I am doing:</p>
  
  <pre><code>#Make rows selectable
  self.tableWidget.setSelectionBehavior(QtWidgets.QTableWidget.SelectRows)
  # Diable button initially
  if not len(self.tableWidget.selectionModel().selectedRows()):
          self.btnDelete.setEnabled(False)
  </code></pre>
  
  <p>This sets Delete button to the disabled state.</p>
  
  <p>How to I enable it on row selection?</p>
  
  <p>Using: 
  Python 3.8 , PyQt5 on Windows10</p>
  
  <p>EDIT 1:
  Minimum working example:</p>
  
  <pre><code>import sys
  from PyQt5 import QtWidgets
  from PyQt5.QtWidgets import QApplication, QWidget, QTableWidget, QTableWidgetItem, QVBoxLayout
  from PyQt5.QtCore import pyqtSlot
  
  class App(QWidget):
  
      def __init__(self):
          super().__init__()
          self.title = 'Fruits'
          self.left = 0
          self.top = 0
          self.width = 300
          self.height = 200
          self.initUI()
  
      def initUI(self):
          self.setWindowTitle(self.title)
          self.setGeometry(self.left, self.top, self.width, self.height)
          self.createTable()
  
          self.btndelete = QtWidgets.QPushButton("DELETE")
          self.btndelete.setObjectName("btndelete")
          self.btndelete.clicked.connect(self.deleteRow)
          if not len(self.tableWidget.selectionModel().selectedRows()):
              self.btndelete.setEnabled(False)
  
          self.layout = QVBoxLayout()
          self.layout.addWidget(self.tableWidget) 
          self.layout.addWidget(self.btndelete)
  
          self.setLayout(self.layout) 
  
          # Show widget
          self.show()
  
      def createTable(self):
         # Create table
          self.tableWidget = QTableWidget()
          self.tableWidget.setRowCount(4)
          self.tableWidget.setColumnCount(2)
          self.tableWidget.setItem(0,0, QTableWidgetItem("Apple"))
          self.tableWidget.setItem(0,1, QTableWidgetItem("15"))
          self.tableWidget.setItem(1,0, QTableWidgetItem("Banana"))
          self.tableWidget.setItem(1,1, QTableWidgetItem("11"))
          self.tableWidget.setItem(2,0, QTableWidgetItem("Dogs"))
          self.tableWidget.setItem(2,1, QTableWidgetItem("10"))
          self.tableWidget.setItem(3,0, QTableWidgetItem("Cats"))
          self.tableWidget.setItem(3,1, QTableWidgetItem("2"))
          self.tableWidget.move(0,0)
  
          # table selection 
          self.tableWidget.setSelectionBehavior(QtWidgets.QTableWidget.SelectRows)
  
      def deleteRow(self):
          pass
  
      @pyqtSlot()
      def on_click(self):
          print("\n")
          for currentQTableWidgetItem in self.tableWidget.selectedItems():
              print(currentQTableWidgetItem.row(), currentQTableWidgetItem.column(), currentQTableWidgetItem.text())
  
  
  if __name__ == '__main__':
      app = QApplication(sys.argv)
      ex = App()
      sys.exit(app.exec_()) 
  
  </code></pre>