Important: Please read the Qt Code of Conduct -

<SOLVED> QTextTableCellFormat help

  • This may seem like a dumb question but I cannot find the answer. Does anyone know how to find and modify a QTextTableCellFormat in a table? Finding the QTextTableCell is easy but my documentation doesn't have a method to access the QTextTableCellFormat for that cell nor can I find a way to access the format using QTextCursor. There are a lot of useful functions of QTextTableCellFormat listed in the documentation but they are all useless unless I can access the cell format.

  • Lifetime Qt Champion


    Unless I'm mistaken, QTextTableCellFormat is a QTextCharFormat which is a QTextFormat which has the toTableCellFormat method. You could try converting the format your get from QTextTableCell with it.

    Hope it helps

  • SGaist:

    Thanks, should have figured this out myself. I ran a short test on a QTextTableCell which I'll call cell. The methods cell.format().isTableCellFormat() returns true so the format is a QTextTableCellFormat in contrast to the documentation (4.8) which lists the format as QTextCharFormat. Haven't tried it yet but I presume this means the additional padding methods of QTextTableCellFormat are now accessible.

Log in to reply