1
<?xml version="1.0" encoding="iso-8859-1"?>
3
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/gui/text/qtexttable.cpp -->
7
<title>Qt 4.0: QTextTable Class Reference</title>
8
<style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
9
a:link { color: #004faf; text-decoration: none }
10
a:visited { color: #672967; text-decoration: none }
11
td.postheader { font-family: sans-serif }
12
tr.address { font-family: sans-serif }
13
body { background: #ffffff; color: black; }</style>
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
19
<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="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="annotated.html"><font color="#004faf">Annotated</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td>
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QTextTable Class Reference</h1>
21
<p>The QTextTable class represents a table in a <a href="qtextdocument.html">QTextDocument</a>. <a href="#details">More...</a></p>
22
<pre>#include <QTextTable></pre><p>Part of the <a href="qtgui.html">QtGui</a> module.</p>
23
<p>Inherits <a href="qtextframe.html">QTextFrame</a>.</p>
25
<li><a href="qtexttable-members.html">List of all members, including inherited members</a></li>
27
<a name="public-functions"></a>
28
<h3>Public Functions</h3>
30
<li><div class="fn"/>QTextTableCell <b><a href="qtexttable.html#cellAt">cellAt</a></b> ( int <i>row</i>, int <i>column</i> ) const</li>
31
<li><div class="fn"/>QTextTableCell <b><a href="qtexttable.html#cellAt-2">cellAt</a></b> ( int <i>position</i> ) const</li>
32
<li><div class="fn"/>QTextTableCell <b><a href="qtexttable.html#cellAt-3">cellAt</a></b> ( const QTextCursor & <i>cursor</i> ) const</li>
33
<li><div class="fn"/>int <b><a href="qtexttable.html#columns">columns</a></b> () const</li>
34
<li><div class="fn"/>QTextTableFormat <b><a href="qtexttable.html#format">format</a></b> () const</li>
35
<li><div class="fn"/>void <b><a href="qtexttable.html#insertColumns">insertColumns</a></b> ( int <i>index</i>, int <i>columns</i> )</li>
36
<li><div class="fn"/>void <b><a href="qtexttable.html#insertRows">insertRows</a></b> ( int <i>index</i>, int <i>rows</i> )</li>
37
<li><div class="fn"/>void <b><a href="qtexttable.html#removeColumns">removeColumns</a></b> ( int <i>index</i>, int <i>columns</i> )</li>
38
<li><div class="fn"/>void <b><a href="qtexttable.html#removeRows">removeRows</a></b> ( int <i>index</i>, int <i>rows</i> )</li>
39
<li><div class="fn"/>void <b><a href="qtexttable.html#resize">resize</a></b> ( int <i>rows</i>, int <i>columns</i> )</li>
40
<li><div class="fn"/>QTextCursor <b><a href="qtexttable.html#rowEnd">rowEnd</a></b> ( const QTextCursor & <i>cursor</i> ) const</li>
41
<li><div class="fn"/>QTextCursor <b><a href="qtexttable.html#rowStart">rowStart</a></b> ( const QTextCursor & <i>cursor</i> ) const</li>
42
<li><div class="fn"/>int <b><a href="qtexttable.html#rows">rows</a></b> () const</li>
43
<li><div class="fn"/>void <b><a href="qtexttable.html#setFormat">setFormat</a></b> ( const QTextTableFormat & <i>format</i> )</li>
46
<li><div class="fn"/>10 public functions inherited from <a href="qtextframe.html#public-functions">QTextFrame</a></li>
47
<li><div class="fn"/>4 public functions inherited from <a href="qtextobject.html#public-functions">QTextObject</a></li>
48
<li><div class="fn"/>28 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
50
<h3>Additional Inherited Members</h3>
52
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
53
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
54
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
55
<li><div class="fn"/>4 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
56
<li><div class="fn"/>1 protected function inherited from <a href="qtextobject.html#protected-functions">QTextObject</a></li>
57
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
59
<a name="details"></a>
61
<h2>Detailed Description</h2>
62
<p>The QTextTable class represents a table in a <a href="qtextdocument.html">QTextDocument</a>.</p>
63
<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>
64
<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>
65
<pre> QTextCursor cursor(editor->textCursor());
66
cursor.movePosition(QTextCursor::Start);
68
QTextTable *table = cursor.insertTable(rows, columns, tableFormat);</pre>
69
<p>The table format is either defined when the table is created or changed later with <a href="qtexttable.html#setFormat">setFormat</a>().</p>
70
<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>
71
<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>
72
<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>
73
<p>See also <a href="qtexttableformat.html">QTextTableFormat</a>.</p>
75
<h2>Member Function Documentation</h2>
76
<h3 class="fn"><a name="cellAt"></a><a href="qtexttablecell.html">QTextTableCell</a> QTextTable::cellAt ( int <i>row</i>, int <i>column</i> ) const</h3>
77
<p>Returns the table cell at the given <i>row</i> and <i>column</i> in the table.</p>
78
<p>See also <a href="qtexttable.html#columns">columns</a>() and <a href="qtexttable.html#rows">rows</a>().</p>
79
<h3 class="fn"><a name="cellAt-2"></a><a href="qtexttablecell.html">QTextTableCell</a> QTextTable::cellAt ( int <i>position</i> ) const</h3>
80
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
81
<p>Returns the table cell that contains the character at the given <i>position</i> in the document.</p>
82
<h3 class="fn"><a name="cellAt-3"></a><a href="qtexttablecell.html">QTextTableCell</a> QTextTable::cellAt ( const <a href="qtextcursor.html">QTextCursor</a> & <i>cursor</i> ) const</h3>
83
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
84
<p>Returns the table cell containing the given <i>cursor</i>.</p>
85
<h3 class="fn"><a name="columns"></a>int QTextTable::columns () const</h3>
86
<p>Returns the number of columns in the table.</p>
87
<p>See also <a href="qtexttable.html#rows">rows</a>().</p>
88
<h3 class="fn"><a name="format"></a><a href="qtexttableformat.html">QTextTableFormat</a> QTextTable::format () const</h3>
89
<p>Returns the table's format.</p>
90
<p>See also <a href="qtexttable.html#setFormat">setFormat</a>().</p>
91
<h3 class="fn"><a name="insertColumns"></a>void QTextTable::insertColumns ( int <i>index</i>, int <i>columns</i> )</h3>
92
<p>Inserts a number of <i>columns</i> before the column with the specified <i>index</i>.</p>
93
<p>See also <a href="qtexttable.html#insertRows">insertRows</a>(), <a href="qtexttable.html#resize">resize</a>(), <a href="qtexttable.html#removeRows">removeRows</a>(), and <a href="qtexttable.html#removeColumns">removeColumns</a>().</p>
94
<h3 class="fn"><a name="insertRows"></a>void QTextTable::insertRows ( int <i>index</i>, int <i>rows</i> )</h3>
95
<p>Inserts a number of <i>rows</i> before the row with the specified <i>index</i>.</p>
96
<p>See also <a href="qtexttable.html#resize">resize</a>(), <a href="qtexttable.html#insertColumns">insertColumns</a>(), <a href="qtexttable.html#removeRows">removeRows</a>(), and <a href="qtexttable.html#removeColumns">removeColumns</a>().</p>
97
<h3 class="fn"><a name="removeColumns"></a>void QTextTable::removeColumns ( int <i>index</i>, int <i>columns</i> )</h3>
98
<p>Removes a number of <i>columns</i> starting with the column at the specified <i>index</i>.</p>
99
<p>See also <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#resize">resize</a>().</p>
100
<h3 class="fn"><a name="removeRows"></a>void QTextTable::removeRows ( int <i>index</i>, int <i>rows</i> )</h3>
101
<p>Removes a number of <i>rows</i> starting with the row at the specified <i>index</i>.</p>
102
<p>See also <a href="qtexttable.html#insertRows">insertRows</a>(), <a href="qtexttable.html#insertColumns">insertColumns</a>(), <a href="qtexttable.html#resize">resize</a>(), and <a href="qtexttable.html#removeColumns">removeColumns</a>().</p>
103
<h3 class="fn"><a name="resize"></a>void QTextTable::resize ( int <i>rows</i>, int <i>columns</i> )</h3>
104
<p>Resizes the table to contain the required number of <i>rows</i> and <i>columns</i>.</p>
105
<p>See also <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>
106
<h3 class="fn"><a name="rowEnd"></a><a href="qtextcursor.html">QTextCursor</a> QTextTable::rowEnd ( const <a href="qtextcursor.html">QTextCursor</a> & <i>cursor</i> ) const</h3>
107
<p>Returns a cursor pointing to the end of the row that contains the given <i>cursor</i>.</p>
108
<p>See also <a href="qtexttable.html#rowStart">rowStart</a>().</p>
109
<h3 class="fn"><a name="rowStart"></a><a href="qtextcursor.html">QTextCursor</a> QTextTable::rowStart ( const <a href="qtextcursor.html">QTextCursor</a> & <i>cursor</i> ) const</h3>
110
<p>Returns a cursor pointing to the start of the row that contains the given <i>cursor</i>.</p>
111
<p>See also <a href="qtexttable.html#rowEnd">rowEnd</a>().</p>
112
<h3 class="fn"><a name="rows"></a>int QTextTable::rows () const</h3>
113
<p>Returns the number of rows in the table.</p>
114
<p>See also <a href="qtexttable.html#columns">columns</a>().</p>
115
<h3 class="fn"><a name="setFormat"></a>void QTextTable::setFormat ( const <a href="qtexttableformat.html">QTextTableFormat</a> & <i>format</i> )</h3>
116
<p>Sets the table's <i>format</i>.</p>
117
<p>See also <a href="qtexttable.html#format">format</a>().</p>
118
<p /><address><hr /><div align="center">
119
<table width="100%" cellspacing="0" border="0"><tr class="address">
120
<td width="30%">Copyright © 2005 <a href="trolltech.html">Trolltech</a></td>
121
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
122
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
123
</tr></table></div></address></body>