Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 1198

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?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>QTextTable 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">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QTextTable Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QTextTable class represents a table in a <a href="qtextdocument.html">QTextDocument</a>. <a href="#details">More...</a></p>

<p>Inherits <a href="qtextframe.html">QTextFrame</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qtexttable.html#QTextTable">__init__</a></b> (<i>self</i>, QTextDocument&#160;<i>doc</i>)</li><li><div class="fn" /><b><a href="qtexttable.html#appendColumns">appendColumns</a></b> (<i>self</i>, int&#160;<i>count</i>)</li><li><div class="fn" /><b><a href="qtexttable.html#appendRows">appendRows</a></b> (<i>self</i>, int&#160;<i>count</i>)</li><li><div class="fn" />QTextTableCell <b><a href="qtexttable.html#cellAt">cellAt</a></b> (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>col</i>)</li><li><div class="fn" />QTextTableCell <b><a href="qtexttable.html#cellAt-2">cellAt</a></b> (<i>self</i>, int&#160;<i>position</i>)</li><li><div class="fn" />QTextTableCell <b><a href="qtexttable.html#cellAt-3">cellAt</a></b> (<i>self</i>, QTextCursor&#160;<i>c</i>)</li><li><div class="fn" />int <b><a href="qtexttable.html#columns">columns</a></b> (<i>self</i>)</li><li><div class="fn" />QTextTableFormat <b><a href="qtexttable.html#format">format</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtexttable.html#insertColumns">insertColumns</a></b> (<i>self</i>, int&#160;<i>pos</i>, int&#160;<i>num</i>)</li><li><div class="fn" /><b><a href="qtexttable.html#insertRows">insertRows</a></b> (<i>self</i>, int&#160;<i>pos</i>, int&#160;<i>num</i>)</li><li><div class="fn" /><b><a href="qtexttable.html#mergeCells">mergeCells</a></b> (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>col</i>, int&#160;<i>numRows</i>, int&#160;<i>numCols</i>)</li><li><div class="fn" /><b><a href="qtexttable.html#mergeCells-2">mergeCells</a></b> (<i>self</i>, QTextCursor&#160;<i>cursor</i>)</li><li><div class="fn" /><b><a href="qtexttable.html#removeColumns">removeColumns</a></b> (<i>self</i>, int&#160;<i>pos</i>, int&#160;<i>num</i>)</li><li><div class="fn" /><b><a href="qtexttable.html#removeRows">removeRows</a></b> (<i>self</i>, int&#160;<i>pos</i>, int&#160;<i>num</i>)</li><li><div class="fn" /><b><a href="qtexttable.html#resize">resize</a></b> (<i>self</i>, int&#160;<i>rows</i>, int&#160;<i>cols</i>)</li><li><div class="fn" />QTextCursor <b><a href="qtexttable.html#rowEnd">rowEnd</a></b> (<i>self</i>, QTextCursor&#160;<i>c</i>)</li><li><div class="fn" />int <b><a href="qtexttable.html#rows">rows</a></b> (<i>self</i>)</li><li><div class="fn" />QTextCursor <b><a href="qtexttable.html#rowStart">rowStart</a></b> (<i>self</i>, QTextCursor&#160;<i>c</i>)</li><li><div class="fn" /><b><a href="qtexttable.html#setFormat">setFormat</a></b> (<i>self</i>, QTextTableFormat&#160;<i>aformat</i>)</li><li><div class="fn" /><b><a href="qtexttable.html#splitCell">splitCell</a></b> (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>col</i>, int&#160;<i>numRows</i>, int&#160;<i>numCols</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QTextTable class represents a table 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, and is surrounded by a frame.</p>
<p>Tables are usually created and inserted into a document with the
<a href="qtextcursor.html#insertTable">QTextCursor.insertTable</a>()
function. For example, we can insert a table with three rows and
two columns at the current cursor position in an editor using the
following lines of code:</p>
<pre class="cpp">
     <span class="type"><a href="qtextcursor.html">QTextCursor</a></span> cursor(editor<span class="operator">-</span><span class="operator">&gt;</span>textCursor());
     cursor<span class="operator">.</span>movePosition(<span class="type"><a href="qtextcursor.html">QTextCursor</a></span><span class="operator">.</span>Start);

     <span class="type">QTextTable</span> <span class="operator">*</span>table <span class="operator">=</span> cursor<span class="operator">.</span>insertTable(rows<span class="operator">,</span> columns<span class="operator">,</span> tableFormat);
</pre>
<p>The table format is either defined when the table is created or
changed later with <a href="qtexttable.html#setFormat">setFormat</a>().</p>
<p>The table currently being edited by the cursor is found with
<a href="qtextcursor.html#currentTable">QTextCursor.currentTable</a>().
This allows its format or dimensions to be changed after it has
been inserted into a document.</p>
<p>A table's size can be changed with <a href="qtexttable.html#resize">resize</a>(), or by using <a href="qtexttable.html#insertRows">insertRows</a>(), <a href="qtexttable.html#insertColumns">insertColumns</a>(), <a href="qtexttable.html#removeRows">removeRows</a>(), or <a href="qtexttable.html#removeColumns">removeColumns</a>(). Use <a href="qtexttable.html#cellAt">cellAt</a>() to retrieve table cells.</p>
<p>The starting and ending positions of table rows can be found by
moving a cursor within a table, and using the <a href="qtexttable.html#rowStart">rowStart</a>() and <a href="qtexttable.html#rowEnd">rowEnd</a>() functions to obtain cursors
at the start and end of each row.</p>
<p>Rows and columns within a QTextTable can be merged and split
using the <a href="qtexttable.html#mergeCells">mergeCells</a>() and
<a href="qtexttable.html#splitCell">splitCell</a>() functions.
However, only cells that span multiple rows or columns can be
split. (Merging or splitting does not increase or decrease the
number of rows and columns.)</p>
<p>Note that if you have merged multiple columns and rows into one
cell, you will not be able to split the merged cell into new cells
spanning over more than one row or column. To be able to split
cells spanning over several rows and columns you need to do this
over several iterations.</p>
<table class="generic" width="80%">
<tr class="odd" valign="top">
<td><img alt="Original Table" src="images/texttable-split.png" /></td>
<td>Suppose we have a 2x3 table of names and addresses. To merge
both columns in the first row we invoke <a href="qtexttable.html#mergeCells">mergeCells</a>() with <i>row</i> = 0,
<i>column</i> = 0, <i>numRows</i> = 1 and <i>numColumns</i> = 2.
<pre class="cpp">
     table<span class="operator">-</span><span class="operator">&gt;</span>mergeCells(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">2</span>);
</pre></td>
</tr>
<tr class="even" valign="top">
<td><img alt="" src="images/texttable-merge.png" /></td>
<td>This gives us the following table. To split the first row of
the table back into two cells, we invoke the <a href="qtexttable.html#splitCell">splitCell</a>() function with
<i>numRows</i> and <i>numCols</i> = 1.
<pre class="cpp">
     table<span class="operator">-</span><span class="operator">&gt;</span>splitCell(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">1</span>);
</pre></td>
</tr>
<tr class="odd" valign="top">
<td><img alt="Split Table" src="images/texttable-split.png" /></td>
<td>This results in the original table.</td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QTextTable" />QTextTable.__init__ (<i>self</i>, <a href="qtextdocument.html">QTextDocument</a>&#160;<i>doc</i>)</h3><h3 class="fn"><a name="appendColumns" />QTextTable.appendColumns (<i>self</i>, int&#160;<i>count</i>)</h3><p>Appends <i>count</i> columns at the right side of the table.</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also</b> <a href="qtexttable.html#insertColumns">insertColumns</a>(), <a href="qtexttable.html#insertRows">insertRows</a>(), <a href="qtexttable.html#resize">resize</a>(), <a href="qtexttable.html#removeRows">removeRows</a>(), <a href="qtexttable.html#removeColumns">removeColumns</a>(), and <a href="qtexttable.html#appendRows">appendRows</a>().</p>


<h3 class="fn"><a name="appendRows" />QTextTable.appendRows (<i>self</i>, int&#160;<i>count</i>)</h3><p>Appends <i>count</i> rows at the bottom of the table.</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also</b> <a href="qtexttable.html#insertColumns">insertColumns</a>(), <a href="qtexttable.html#insertRows">insertRows</a>(), <a href="qtexttable.html#resize">resize</a>(), <a href="qtexttable.html#removeRows">removeRows</a>(), <a href="qtexttable.html#removeColumns">removeColumns</a>(), and <a href="qtexttable.html#appendColumns">appendColumns</a>().</p>


<h3 class="fn"><a name="cellAt" /><a href="qtexttablecell.html">QTextTableCell</a> QTextTable.cellAt (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>col</i>)</h3><p>Returns the table cell at the given <i>row</i> and <i>column</i>
in the table.</p>
<p><b>See also</b> <a href="qtexttable.html#columns">columns</a>()
and <a href="qtexttable.html#rows">rows</a>().</p>


<h3 class="fn"><a name="cellAt-2" /><a href="qtexttablecell.html">QTextTableCell</a> QTextTable.cellAt (<i>self</i>, int&#160;<i>position</i>)</h3><p>This is an overloaded function.</p>
<p>Returns the table cell that contains the character at the given
<i>position</i> in the document.</p>


<h3 class="fn"><a name="cellAt-3" /><a href="qtexttablecell.html">QTextTableCell</a> QTextTable.cellAt (<i>self</i>, <a href="qtextcursor.html">QTextCursor</a>&#160;<i>c</i>)</h3><p>This is an overloaded function.</p>
<p>Returns the table cell containing the given <i>cursor</i>.</p>


<h3 class="fn"><a name="columns" />int QTextTable.columns (<i>self</i>)</h3><p>Returns the number of columns in the table.</p>
<p><b>See also</b> <a href="qtexttable.html#rows">rows</a>().</p>


<h3 class="fn"><a name="format" /><a href="qtexttableformat.html">QTextTableFormat</a> QTextTable.format (<i>self</i>)</h3><p>Returns the table's format.</p>
<p><b>See also</b> <a href="qtexttable.html#setFormat">setFormat</a>().</p>


<h3 class="fn"><a name="insertColumns" />QTextTable.insertColumns (<i>self</i>, int&#160;<i>pos</i>, int&#160;<i>num</i>)</h3><p>Inserts a number of <i>columns</i> before the column with the
specified <i>index</i>.</p>
<p><b>See also</b> <a href="qtexttable.html#insertRows">insertRows</a>(), <a href="qtexttable.html#resize">resize</a>(), <a href="qtexttable.html#removeRows">removeRows</a>(), <a href="qtexttable.html#removeColumns">removeColumns</a>(), <a href="qtexttable.html#appendRows">appendRows</a>(), and <a href="qtexttable.html#appendColumns">appendColumns</a>().</p>


<h3 class="fn"><a name="insertRows" />QTextTable.insertRows (<i>self</i>, int&#160;<i>pos</i>, int&#160;<i>num</i>)</h3><p>Inserts a number of <i>rows</i> before the row with the
specified <i>index</i>.</p>
<p><b>See also</b> <a href="qtexttable.html#resize">resize</a>(),
<a href="qtexttable.html#insertColumns">insertColumns</a>(),
<a href="qtexttable.html#removeRows">removeRows</a>(), <a href="qtexttable.html#removeColumns">removeColumns</a>(), <a href="qtexttable.html#appendRows">appendRows</a>(), and <a href="qtexttable.html#appendColumns">appendColumns</a>().</p>


<h3 class="fn"><a name="mergeCells" />QTextTable.mergeCells (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>col</i>, int&#160;<i>numRows</i>, int&#160;<i>numCols</i>)</h3><p>Merges the cell at the specified <i>row</i> and <i>column</i>
with the adjacent cells into one cell. The new cell will span
<i>numRows</i> rows and <i>numCols</i> columns. If <i>numRows</i>
or <i>numCols</i> is less than the current number of rows or
columns the cell spans then this method does nothing.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qtexttable.html#splitCell">splitCell</a>().</p>


<h3 class="fn"><a name="mergeCells-2" />QTextTable.mergeCells (<i>self</i>, <a href="qtextcursor.html">QTextCursor</a>&#160;<i>cursor</i>)</h3><p>This is an overloaded function.</p>
<p>Merges the cells selected by the provided <i>cursor</i>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qtexttable.html#splitCell">splitCell</a>().</p>


<h3 class="fn"><a name="removeColumns" />QTextTable.removeColumns (<i>self</i>, int&#160;<i>pos</i>, int&#160;<i>num</i>)</h3><p>Removes a number of <i>columns</i> starting with the column at
the specified <i>index</i>.</p>
<p><b>See also</b> <a href="qtexttable.html#insertRows">insertRows</a>(), <a href="qtexttable.html#insertColumns">insertColumns</a>(), <a href="qtexttable.html#removeRows">removeRows</a>(), <a href="qtexttable.html#resize">resize</a>(), <a href="qtexttable.html#appendRows">appendRows</a>(), and <a href="qtexttable.html#appendColumns">appendColumns</a>().</p>


<h3 class="fn"><a name="removeRows" />QTextTable.removeRows (<i>self</i>, int&#160;<i>pos</i>, int&#160;<i>num</i>)</h3><p>Removes a number of <i>rows</i> starting with the row at the
specified <i>index</i>.</p>
<p><b>See also</b> <a href="qtexttable.html#insertRows">insertRows</a>(), <a href="qtexttable.html#insertColumns">insertColumns</a>(), <a href="qtexttable.html#resize">resize</a>(), <a href="qtexttable.html#removeColumns">removeColumns</a>(), <a href="qtexttable.html#appendRows">appendRows</a>(), and <a href="qtexttable.html#appendColumns">appendColumns</a>().</p>


<h3 class="fn"><a name="resize" />QTextTable.resize (<i>self</i>, int&#160;<i>rows</i>, int&#160;<i>cols</i>)</h3><p>Resizes the table to contain the required number of <i>rows</i>
and <i>columns</i>.</p>
<p><b>See also</b> <a href="qtexttable.html#insertRows">insertRows</a>(), <a href="qtexttable.html#insertColumns">insertColumns</a>(), <a href="qtexttable.html#removeRows">removeRows</a>(), and <a href="qtexttable.html#removeColumns">removeColumns</a>().</p>


<h3 class="fn"><a name="rowEnd" /><a href="qtextcursor.html">QTextCursor</a> QTextTable.rowEnd (<i>self</i>, <a href="qtextcursor.html">QTextCursor</a>&#160;<i>c</i>)</h3><p>Returns a cursor pointing to the end of the row that contains
the given <i>cursor</i>.</p>
<p><b>See also</b> <a href="qtexttable.html#rowStart">rowStart</a>().</p>


<h3 class="fn"><a name="rows" />int QTextTable.rows (<i>self</i>)</h3><p>Returns the number of rows in the table.</p>
<p><b>See also</b> <a href="qtexttable.html#columns">columns</a>().</p>


<h3 class="fn"><a name="rowStart" /><a href="qtextcursor.html">QTextCursor</a> QTextTable.rowStart (<i>self</i>, <a href="qtextcursor.html">QTextCursor</a>&#160;<i>c</i>)</h3><p>Returns a cursor pointing to the start of the row that contains
the given <i>cursor</i>.</p>
<p><b>See also</b> <a href="qtexttable.html#rowEnd">rowEnd</a>().</p>


<h3 class="fn"><a name="setFormat" />QTextTable.setFormat (<i>self</i>, <a href="qtexttableformat.html">QTextTableFormat</a>&#160;<i>aformat</i>)</h3><p>Sets the table's <i>format</i>.</p>
<p><b>See also</b> <a href="qtexttable.html#format">format</a>().</p>


<h3 class="fn"><a name="splitCell" />QTextTable.splitCell (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>col</i>, int&#160;<i>numRows</i>, int&#160;<i>numCols</i>)</h3><p>Splits the specified cell at <i>row</i> and <i>column</i> into
an array of multiple cells with dimensions specified by
<i>numRows</i> and <i>numCols</i>.</p>
<p><b>Note:</b> It is only possible to split cells that span
multiple rows or columns, such as rows that have been merged using
<a href="qtexttable.html#mergeCells">mergeCells</a>().</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qtexttable.html#mergeCells">mergeCells</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>