Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1035

Error counting columns with more than one QTableWidget

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.12.5
    • 5.12.4
    • PySide
    • None
    • Ubuntu 18.04.2 (on virtualbox)
    • Linux/X11
    • 3c402fef54106b65ab9c1df92c39c4626424fdd8 (pyside/pyside-tools/5.12)

    Description

      When generating the python code of a Widget with multiple *QTableWidget*s, the index that is assigned to the *horizontalHeaderItem*s keeps incrementing. See code snippet.

      self.tableWidget.setColumnCount(3)
      self.tableWidget_2.setColumnCount(3)
      
      ...
      
      self.tableWidget.horizontalHeaderItem(0).setText(QtWidgets.QApplication.translate("MyForm", "New Column", None, -1))
      self.tableWidget.horizontalHeaderItem(1).setText(QtWidgets.QApplication.translate("MyForm", "New Column", None, -1))
      self.tableWidget.horizontalHeaderItem(2).setText(QtWidgets.QApplication.translate("MyForm", "New Column", None, -1))
      
      self.tableWidget_2.horizontalHeaderItem(3).setText(QtWidgets.QApplication.translate("MyForm", "New Column", None, -1))
      self.tableWidget_2.horizontalHeaderItem(4).setText(QtWidgets.QApplication.translate("MyForm", "New Column", None, -1))
      self.tableWidget_2.horizontalHeaderItem(5).setText(QtWidgets.QApplication.translate("MyForm", "New Column", None, -1))
      

      As a result, the code crashes as it tries to set the text in an Item that doesnt exist for the tableWidget_2

       

      Attachments

        1. bug_1035.py
          3 kB
        2. bug_1035.ui
          2 kB
        For Gerrit Dashboard: PYSIDE-1035
        # Subject Branch Project Status CR V

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            giraldtec Carlos Giraldo
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes