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

Error counting columns with more than one QTableWidget

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 5.12.4
    • Fix Version/s: 5.12.5
    • Component/s: PySide
    • Labels:
      None
    • Environment:
      Ubuntu 18.04.2 (on virtualbox)
    • Platform/s:
      Linux/X11
    • Commits:
      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
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              crmaurei Cristian Maureira-Fredes
              Reporter:
              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