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

when I use QTextCursor insert new QTextTable, the border of the table is not visible.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.8.1
    • GUI: Text handling
    • None
    • windows10
    • Windows

    Description

      there is the image of the bug.

      The code as bellow:

          QTextEdit*    textEdit = new QTextEdit(this);
          QTextCursor cursor   = textEdit->textCursor();

          
          QTextTableFormat tableFormat; // 定义表格格式
          tableFormat.setBorder(1);          // 设置边框宽度为 1
          tableFormat.setBorderStyle(QTextFrameFormat::BorderStyle_Dotted); // 设置边框样式为实线
          tableFormat.setCellSpacing(10); // 单元格间距
          tableFormat.setCellPadding(20); // 单元格内边距

          int rows = 3;
          int columns = 4;
          // 插入一个 3 行 4 列的表格
          QTextTable *table = cursor.insertTable(rows, columns, tableFormat);

          // 填充表格内容
          for (int row = 0; row < rows; ++row) {
              for (int col = 0; col < columns; ++col)

      {             // 获取单元格光标             QTextCursor cellCursor = table->cellAt(row, col).firstCursorPosition();             // 插入文本             cellCursor.insertText(QString("行 %1, 列 %2").arg(row + 1).arg(col + 1));         }

          }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            fgc f gc
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes