Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-79148

QTextTable insertColumns fails at rowSpan > 1.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.12
    • None
    • Windows

    Description

      How to use sample code.

      1. press 0
      2. select row 1- 2, column 0 by mouse and merge the selected cells by pressing 1.
      3. do the same thing at all columns
      4. insertColumns by pressing 2
      5. the test application falls.

      It seems that the inserted column cells are randomly.

      no assertion with PySide...

      from:

      row span1 row span1 row span1
      row span1 row span1 row span1
      row span1 row span1 row span1

      to:

      row span1 row span1 row span1
      row span2 row span2 row span2
       
      from PySide2 import QtGui
      from PySide2 import QtCore
      from PySide2 import QtWidgets
      import sys, os
      import PySide2
      #Bug If you merge cells at all columns, and insertColumns, application falls.
      class TextEdit(QtWidgets.QTextEdit):    
          def __init__(self, parent=None):        
              super(TextEdit, self).__init__(parent=None)            
          def keyPressEvent(self, event):        
              if event.key() == QtCore.Qt.Key_0:            
                  tc = self.textCursor()            
                  columnwidthconstraints = [QtGui.QTextLength(QtGui.QTextLength.VariableLength, 100) for i in range(3)]            
                  tableformat = QtGui.QTextTableFormat()            
                  tableformat.setColumnWidthConstraints(columnwidthconstraints)            
                  tableformat.setWidth(300)            
                  tc.insertTable(3, 3, tableformat)            
                  return        
              if event.key() == QtCore.Qt.Key_1:            
                  tc = self.textCursor()            
                  currentTable = tc.currentTable()            
                  if currentTable is not None:                
                      currentTable.mergeCells(tc)            
                      return        
              if event.key() == QtCore.Qt.Key_2:            
                  tc = self.textCursor()            
                  currentTable = tc.currentTable()            
                  if currentTable is not None:                
                      cell = currentTable.cellAt(tc)                
                      currentTable.insertColumns(cell.column(), 1)            
                      return        
              return QtWidgets.QTextEdit.keyPressEvent(self, event)
      def main():    
          QtWidgets.QApplication([])    
          t = TextEdit()    
          t.setGeometry(300, 300, 500, 100)    
          t.show()    
          sys.exit(QtWidgets.QApplication.exec_())
      if __name__ == "__main__":    
          main()

      Other things:

      The errors appears at different aspects but the reason is ascribed to insertColumns method.

      For example,
      The assignments of cells are changed and scattered.

      Attachments

        1. qtbug-79148.zip
          1 kB
          Kai Köhne
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            nori Harunori Fujimoto
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes