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

Background color for QTextCharFormat

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2: Important P2: Important
    • None
    • 4.7.4
    • GUI: Text handling
    • None
    • Windows

      When a QTextTable is created to a QTextDocument and the background color is set with QTextCharFormat, an ODF file is created and the background color is used as the highlight color for the text. The background color for the table is not set. If an html file is created the background color is set for the table cell. The following example will show the issue:

      int main(int argc, char *argv[])
      {
      	QApplication app(argc, argv);
      
      	QTextDocument doc;
      	QTextTableFormat formatTable;
              QTextCursor cursor(&doc);
      	formatTable.setCellPadding(10.0);
      	QTextTable * pTable = cursor.insertTable(1,1,formatTable);
              QTextTableCell cell = pTable->cellAt(0,0);
      	QTextCharFormat format = cell.format(); 
              format.setBackground(Qt::blue);
      	cell.setFormat(format);
              cursor.insertText("hello");
      	QTextDocumentWriter("test.odt","odf").write(&doc);
              QTextDocumentWriter("test.html","html").write(&doc);
      
              return 0;
      }
      

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

            Unassigned Unassigned
            qtcomsupport Qt Support
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes