<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QTextTableFormat Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QTextTableFormat Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QTextTableFormat class provides formatting information for tables in a <a href="qtextdocument.html">QTextDocument</a>. <a href="#details">More...</a></p> <p>Inherits <a href="qtextframeformat.html">QTextFrameFormat</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qtexttableformat.html#QTextTableFormat">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtexttableformat.html#QTextTableFormat-2">__init__</a></b> (<i>self</i>, QTextTableFormat)</li><li><div class="fn" />Qt.Alignment <b><a href="qtexttableformat.html#alignment">alignment</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtexttableformat.html#cellPadding">cellPadding</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtexttableformat.html#cellSpacing">cellSpacing</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtexttableformat.html#clearColumnWidthConstraints">clearColumnWidthConstraints</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtexttableformat.html#columns">columns</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-QTextLength <b><a href="qtexttableformat.html#columnWidthConstraints">columnWidthConstraints</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtexttableformat.html#headerRowCount">headerRowCount</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtexttableformat.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtexttableformat.html#setAlignment">setAlignment</a></b> (<i>self</i>, Qt.Alignment <i>aalignment</i>)</li><li><div class="fn" /><b><a href="qtexttableformat.html#setCellPadding">setCellPadding</a></b> (<i>self</i>, float <i>apadding</i>)</li><li><div class="fn" /><b><a href="qtexttableformat.html#setCellSpacing">setCellSpacing</a></b> (<i>self</i>, float <i>spacing</i>)</li><li><div class="fn" /><b><a href="qtexttableformat.html#setColumns">setColumns</a></b> (<i>self</i>, int <i>acolumns</i>)</li><li><div class="fn" /><b><a href="qtexttableformat.html#setColumnWidthConstraints">setColumnWidthConstraints</a></b> (<i>self</i>, list-of-QTextLength <i>constraints</i>)</li><li><div class="fn" /><b><a href="qtexttableformat.html#setHeaderRowCount">setHeaderRowCount</a></b> (<i>self</i>, int <i>count</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QTextTableFormat class provides formatting information for tables in a <a href="qtextdocument.html">QTextDocument</a>.</p> <p>A table is a group of cells ordered into rows and columns. Each table contains at least one row and one column. Each cell contains a block. Tables in rich text documents are formatted using the properties defined in this class.</p> <p>Tables are horizontally justified within their parent frame according to the table's alignment. This can be read with the <a href="qtexttableformat.html#alignment">alignment</a>() function and set with <a href="qtexttableformat.html#setAlignment">setAlignment</a>().</p> <p>Cells within the table are separated by cell spacing. The number of pixels between cells is set with <a href="qtexttableformat.html#setCellSpacing">setCellSpacing</a>() and read with <a href="qtexttableformat.html#cellSpacing">cellSpacing</a>(). The contents of each cell is surrounded by cell padding. The number of pixels between each cell edge and its contents is set with <a href="qtexttableformat.html#setCellPadding">setCellPadding</a>() and read with <a href="qtexttableformat.html#cellPadding">cellPadding</a>().</p> <p class="centerAlign"><img alt="" src="images/qtexttableformat-cell.png" /></p> <p>The table's background color can be read with the <a href="qtextformat.html#background">background</a>() function, and can be specified with <a href="qtextformat.html#setBackground">setBackground</a>(). The background color of each cell can be set independently, and will control the color of the cell within the padded area.</p> <p>The table format also provides a way to constrain the widths of the columns in the table. Columns can be assigned a fixed width, a variable width, or a percentage of the available width (see <a href="qtextlength.html">QTextLength</a>). The <a href="qtexttableformat.html#columns">columns</a>() function returns the number of columns with constraints, and the <a href="qtexttableformat.html#columnWidthConstraints">columnWidthConstraints</a>() function returns the constraints defined for the table. These quantities can also be set by calling <a href="qtexttableformat.html#setColumnWidthConstraints">setColumnWidthConstraints</a>() with a vector containing new constraints. If no constraints are required, <a href="qtexttableformat.html#clearColumnWidthConstraints">clearColumnWidthConstraints</a>() can be used to remove them.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QTextTableFormat" />QTextTableFormat.__init__ (<i>self</i>)</h3><p>Constructs a new table format object.</p> <h3 class="fn"><a name="QTextTableFormat-2" />QTextTableFormat.__init__ (<i>self</i>, <a href="qtexttableformat.html">QTextTableFormat</a>)</h3><h3 class="fn"><a name="alignment" /><a href="qt-alignment.html">Qt.Alignment</a> QTextTableFormat.alignment (<i>self</i>)</h3><p>Returns the table's alignment.</p> <p><b>See also</b> <a href="qtexttableformat.html#setAlignment">setAlignment</a>().</p> <h3 class="fn"><a name="cellPadding" />float QTextTableFormat.cellPadding (<i>self</i>)</h3><p>Returns the table's cell padding. This describes the distance between the border of a cell and its contents.</p> <p><b>See also</b> <a href="qtexttableformat.html#setCellPadding">setCellPadding</a>().</p> <h3 class="fn"><a name="cellSpacing" />float QTextTableFormat.cellSpacing (<i>self</i>)</h3><p>Returns the table's cell spacing. This describes the distance between adjacent cells.</p> <p><b>See also</b> <a href="qtexttableformat.html#setCellSpacing">setCellSpacing</a>().</p> <h3 class="fn"><a name="clearColumnWidthConstraints" />QTextTableFormat.clearColumnWidthConstraints (<i>self</i>)</h3><p>Clears the column width constraints for the table.</p> <p><b>See also</b> <a href="qtexttableformat.html#columnWidthConstraints">columnWidthConstraints</a>() and <a href="qtexttableformat.html#setColumnWidthConstraints">setColumnWidthConstraints</a>().</p> <h3 class="fn"><a name="columns" />int QTextTableFormat.columns (<i>self</i>)</h3><p>Returns the number of columns specified by the table format.</p> <h3 class="fn"><a name="columnWidthConstraints" />list-of-QTextLength QTextTableFormat.columnWidthConstraints (<i>self</i>)</h3><p>Returns a list of constraints used by this table format to control the appearance of columns in a table.</p> <p><b>See also</b> <a href="qtexttableformat.html#setColumnWidthConstraints">setColumnWidthConstraints</a>().</p> <h3 class="fn"><a name="headerRowCount" />int QTextTableFormat.headerRowCount (<i>self</i>)</h3><p>Returns the number of rows in the table that define the header.</p> <p>This function was introduced in Qt 4.2.</p> <p><b>See also</b> <a href="qtexttableformat.html#setHeaderRowCount">setHeaderRowCount</a>().</p> <h3 class="fn"><a name="isValid" />bool QTextTableFormat.isValid (<i>self</i>)</h3><p>Returns true if this table format is valid; otherwise returns false.</p> <h3 class="fn"><a name="setAlignment" />QTextTableFormat.setAlignment (<i>self</i>, <a href="qt-alignment.html">Qt.Alignment</a> <i>aalignment</i>)</h3><p>Sets the table's <i>alignment</i>.</p> <p><b>See also</b> <a href="qtexttableformat.html#alignment">alignment</a>().</p> <h3 class="fn"><a name="setCellPadding" />QTextTableFormat.setCellPadding (<i>self</i>, float <i>apadding</i>)</h3><p>Sets the cell <i>padding</i> for the table. This determines the distance between the border of a cell and its contents.</p> <p><b>See also</b> <a href="qtexttableformat.html#cellPadding">cellPadding</a>().</p> <h3 class="fn"><a name="setCellSpacing" />QTextTableFormat.setCellSpacing (<i>self</i>, float <i>spacing</i>)</h3><p>Sets the cell <i>spacing</i> for the table. This determines the distance between adjacent cells.</p> <p><b>See also</b> <a href="qtexttableformat.html#cellSpacing">cellSpacing</a>().</p> <h3 class="fn"><a name="setColumns" />QTextTableFormat.setColumns (<i>self</i>, int <i>acolumns</i>)</h3><h3 class="fn"><a name="setColumnWidthConstraints" />QTextTableFormat.setColumnWidthConstraints (<i>self</i>, list-of-QTextLength <i>constraints</i>)</h3><p>Sets the column width <i>constraints</i> for the table.</p> <p><b>See also</b> <a href="qtexttableformat.html#columnWidthConstraints">columnWidthConstraints</a>() and <a href="qtexttableformat.html#clearColumnWidthConstraints">clearColumnWidthConstraints</a>().</p> <h3 class="fn"><a name="setHeaderRowCount" />QTextTableFormat.setHeaderRowCount (<i>self</i>, int <i>count</i>)</h3><p>Declares the first <i>count</i> rows of the table as table header. The table header rows get repeated when a table is broken across a page boundary.</p> <p>This function was introduced in Qt 4.2.</p> <p><b>See also</b> <a href="qtexttableformat.html#headerRowCount">headerRowCount</a>().</p> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>