title: PyQt5: Closeable tabs in QTabWidget?
body: <p>I have been trying to implement QTabWidget section in my application, and would like to be able to close the tabs if needed.</p>
  
  <p>I read that I need to set the setTabsCloseable flag to true and add a pyqtSignal but I cannot do so because QObject has no connect attribute.
  On the contrary most examples I have found online, mention the use of QtCore.QObject.Connect()</p>
  
  <p>here is a minimum reproducible example:</p>
  
  <pre class="lang-py prettyprint-override"><code>from PyQt5 import QtWidgets, QtCore, QtWidgets
  import sys, os
  
  
  class Dialog_01(QtWidgets.QMainWindow):
      def __init__(self):
          super(Dialog_01,self).__init__()
  
          mainWidget=QtWidgets.QWidget()
          self.setCentralWidget(mainWidget)
          mainLayout = QtWidgets.QVBoxLayout()
          mainWidget.setLayout(mainLayout)
  
          self.tabWidget = QtWidgets.QTabWidget()
          self.tabWidget.setTabsClosable(True)
          # QtCore.QObject.connect(self.chatView, QtCore.SIGNAL('tabCloseRequested(int)'), self.closeTab)
          mainLayout.addWidget(self.tabWidget)
  
  
          myBoxLayout = QtWidgets.QVBoxLayout()
          self.tabWidget.setLayout(myBoxLayout)
  
          self.tabWidget.addTab(QtWidgets.QWidget(),'Tab_01')        
  
  
  
  if __name__ == '__main__':
      app = QtWidgets.QApplication(sys.argv)
      dialog_1 = Dialog_01()
      dialog_1.show()
      dialog_1.resize(480,320)
      sys.exit(app.exec_())
  </code></pre>