You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
810 lines
56 KiB
810 lines
56 KiB
13 years ago
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/sql/qdatatable.cpp:130 -->
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
|
<title>TQDataTable Class</title>
|
||
|
<style type="text/css"><!--
|
||
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
||
|
a:link { color: #004faf; text-decoration: none }
|
||
|
a:visited { color: #672967; text-decoration: none }
|
||
|
body { background: #ffffff; color: black; }
|
||
|
--></style>
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||
|
<tr bgcolor="#E5E5E5">
|
||
|
<td 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>
|
||
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQDataTable Class Reference<br><small>[<a href="sql.html">sql module</a>]</small></h1>
|
||
|
|
||
|
<p>The TQDataTable class provides a flexible SQL table widget that supports browsing and editing.
|
||
|
<a href="#details">More...</a>
|
||
13 years ago
|
<p><tt>#include <<a href="qdatatable-h.html">ntqdatatable.h</a>></tt>
|
||
|
<p>Inherits <a href="ntqtable.html">TQTable</a>.
|
||
13 years ago
|
<p><a href="qdatatable-members.html">List of all member functions.</a>
|
||
|
<h2>Public Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn><a href="#TQDataTable"><b>TQDataTable</b></a> ( TQWidget * parent = 0, const char * name = 0 )</li>
|
||
|
<li class=fn><a href="#TQDataTable-2"><b>TQDataTable</b></a> ( TQSqlCursor * cursor, bool autoPopulate = FALSE, TQWidget * parent = 0, const char * name = 0 )</li>
|
||
|
<li class=fn><a href="#~TQDataTable"><b>~TQDataTable</b></a> ()</li>
|
||
|
<li class=fn>virtual void <a href="#addColumn"><b>addColumn</b></a> ( const TQString & fieldName, const TQString & label = TQString::null, int width = -1, const TQIconSet & iconset = TQIconSet ( ) )</li>
|
||
|
<li class=fn>virtual void <a href="#removeColumn"><b>removeColumn</b></a> ( uint col )</li>
|
||
|
<li class=fn>virtual void <a href="#setColumn"><b>setColumn</b></a> ( uint col, const TQString & fieldName, const TQString & label = TQString::null, int width = -1, const TQIconSet & iconset = TQIconSet ( ) )</li>
|
||
|
<li class=fn>TQString <a href="#nullText"><b>nullText</b></a> () const</li>
|
||
|
<li class=fn>TQString <a href="#trueText"><b>trueText</b></a> () const</li>
|
||
|
<li class=fn>TQString <a href="#falseText"><b>falseText</b></a> () const</li>
|
||
|
<li class=fn>DateFormat <a href="#dateFormat"><b>dateFormat</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#confirmEdits"><b>confirmEdits</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#confirmInsert"><b>confirmInsert</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#confirmUpdate"><b>confirmUpdate</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#confirmDelete"><b>confirmDelete</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#confirmCancels"><b>confirmCancels</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#autoDelete"><b>autoDelete</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#autoEdit"><b>autoEdit</b></a> () const</li>
|
||
|
<li class=fn>TQString <a href="#filter"><b>filter</b></a> () const</li>
|
||
|
<li class=fn>TQStringList <a href="#sort"><b>sort</b></a> () const</li>
|
||
|
<li class=fn>virtual void <a href="#setSqlCursor"><b>setSqlCursor</b></a> ( TQSqlCursor * cursor = 0, bool autoPopulate = FALSE, bool autoDelete = FALSE )</li>
|
||
|
<li class=fn>TQSqlCursor * <a href="#sqlCursor"><b>sqlCursor</b></a> () const</li>
|
||
|
<li class=fn>virtual void <a href="#setNullText"><b>setNullText</b></a> ( const TQString & nullText )</li>
|
||
|
<li class=fn>virtual void <a href="#setTrueText"><b>setTrueText</b></a> ( const TQString & trueText )</li>
|
||
|
<li class=fn>virtual void <a href="#setFalseText"><b>setFalseText</b></a> ( const TQString & falseText )</li>
|
||
|
<li class=fn>virtual void <a href="#setDateFormat"><b>setDateFormat</b></a> ( const DateFormat f )</li>
|
||
|
<li class=fn>virtual void <a href="#setConfirmEdits"><b>setConfirmEdits</b></a> ( bool confirm )</li>
|
||
|
<li class=fn>virtual void <a href="#setConfirmInsert"><b>setConfirmInsert</b></a> ( bool confirm )</li>
|
||
|
<li class=fn>virtual void <a href="#setConfirmUpdate"><b>setConfirmUpdate</b></a> ( bool confirm )</li>
|
||
|
<li class=fn>virtual void <a href="#setConfirmDelete"><b>setConfirmDelete</b></a> ( bool confirm )</li>
|
||
|
<li class=fn>virtual void <a href="#setConfirmCancels"><b>setConfirmCancels</b></a> ( bool confirm )</li>
|
||
|
<li class=fn>virtual void <a href="#setAutoDelete"><b>setAutoDelete</b></a> ( bool enable )</li>
|
||
|
<li class=fn>virtual void <a href="#setAutoEdit"><b>setAutoEdit</b></a> ( bool autoEdit )</li>
|
||
|
<li class=fn>virtual void <a href="#setFilter"><b>setFilter</b></a> ( const TQString & filter )</li>
|
||
|
<li class=fn>virtual void <a href="#setSort"><b>setSort</b></a> ( const TQStringList & sort )</li>
|
||
|
<li class=fn>virtual void <a href="#setSort-2"><b>setSort</b></a> ( const TQSqlIndex & sort )</li>
|
||
|
<li class=fn>enum <a href="#Refresh-enum"><b>Refresh</b></a> { RefreshData = 1, RefreshColumns = 2, RefreshAll = 3 }</li>
|
||
|
<li class=fn>void <a href="#refresh-2"><b>refresh</b></a> ( Refresh mode )</li>
|
||
|
<li class=fn>virtual void <a href="#sortColumn"><b>sortColumn</b></a> ( int col, bool ascending = TRUE, bool wholeRows = FALSE )</li>
|
||
|
<li class=fn>virtual TQString <a href="#text"><b>text</b></a> ( int row, int col ) const</li>
|
||
|
<li class=fn>TQVariant <a href="#value"><b>value</b></a> ( int row, int col ) const</li>
|
||
|
<li class=fn>TQSqlRecord * <a href="#currentRecord"><b>currentRecord</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#installEditorFactory"><b>installEditorFactory</b></a> ( TQSqlEditorFactory * f )</li>
|
||
|
<li class=fn>void <a href="#installPropertyMap"><b>installPropertyMap</b></a> ( TQSqlPropertyMap * m )</li>
|
||
|
<li class=fn>virtual int <a href="#numCols"><b>numCols</b></a> () const</li>
|
||
|
<li class=fn>virtual int <a href="#numRows"><b>numRows</b></a> () const</li>
|
||
|
</ul>
|
||
|
<h2>Public Slots</h2>
|
||
|
<ul>
|
||
|
<li class=fn>virtual void <a href="#find"><b>find</b></a> ( const TQString & str, bool caseSensitive, bool backwards )</li>
|
||
|
<li class=fn>virtual void <a href="#sortAscending"><b>sortAscending</b></a> ( int col )</li>
|
||
|
<li class=fn>virtual void <a href="#sortDescending"><b>sortDescending</b></a> ( int col )</li>
|
||
|
<li class=fn>virtual void <a href="#refresh"><b>refresh</b></a> ()</li>
|
||
|
<li class=fn>virtual void <a href="#setColumnWidth"><b>setColumnWidth</b></a> ( int col, int w )</li>
|
||
|
<li class=fn>virtual void <a href="#adjustColumn"><b>adjustColumn</b></a> ( int col )</li>
|
||
|
</ul>
|
||
|
<h2>Signals</h2>
|
||
|
<ul>
|
||
|
<li class=fn>void <a href="#currentChanged"><b>currentChanged</b></a> ( TQSqlRecord * record )</li>
|
||
|
<li class=fn>void <a href="#primeInsert"><b>primeInsert</b></a> ( TQSqlRecord * buf )</li>
|
||
|
<li class=fn>void <a href="#primeUpdate"><b>primeUpdate</b></a> ( TQSqlRecord * buf )</li>
|
||
|
<li class=fn>void <a href="#primeDelete"><b>primeDelete</b></a> ( TQSqlRecord * buf )</li>
|
||
|
<li class=fn>void <a href="#beforeInsert"><b>beforeInsert</b></a> ( TQSqlRecord * buf )</li>
|
||
|
<li class=fn>void <a href="#beforeUpdate"><b>beforeUpdate</b></a> ( TQSqlRecord * buf )</li>
|
||
|
<li class=fn>void <a href="#beforeDelete"><b>beforeDelete</b></a> ( TQSqlRecord * buf )</li>
|
||
|
<li class=fn>void <a href="#cursorChanged"><b>cursorChanged</b></a> ( TQSql::Op mode )</li>
|
||
|
</ul>
|
||
|
<h2>Properties</h2>
|
||
|
<ul>
|
||
|
<li class=fn>bool <a href="#autoEdit-prop"><b>autoEdit</b></a> - whether the data table automatically applies edits</li>
|
||
|
<li class=fn>bool <a href="#confirmCancels-prop"><b>confirmCancels</b></a> - whether the data table confirms cancel operations</li>
|
||
|
<li class=fn>bool <a href="#confirmDelete-prop"><b>confirmDelete</b></a> - whether the data table confirms delete operations</li>
|
||
|
<li class=fn>bool <a href="#confirmEdits-prop"><b>confirmEdits</b></a> - whether the data table confirms edit operations</li>
|
||
|
<li class=fn>bool <a href="#confirmInsert-prop"><b>confirmInsert</b></a> - whether the data table confirms insert operations</li>
|
||
|
<li class=fn>bool <a href="#confirmUpdate-prop"><b>confirmUpdate</b></a> - whether the data table confirms update operations</li>
|
||
|
<li class=fn>DateFormat <a href="#dateFormat-prop"><b>dateFormat</b></a> - the format used for displaying date/time values</li>
|
||
|
<li class=fn>TQString <a href="#falseText-prop"><b>falseText</b></a> - the text used to represent false values</li>
|
||
|
<li class=fn>TQString <a href="#filter-prop"><b>filter</b></a> - the data filter for the data table</li>
|
||
|
<li class=fn>TQString <a href="#nullText-prop"><b>nullText</b></a> - the text used to represent NULL values</li>
|
||
|
<li class=fn>int <a href="#numCols-prop"><b>numCols</b></a> - the number of columns in the table <em>(read only)</em></li>
|
||
|
<li class=fn>int <a href="#numRows-prop"><b>numRows</b></a> - the number of rows in the table <em>(read only)</em></li>
|
||
|
<li class=fn>TQStringList <a href="#sort-prop"><b>sort</b></a> - the data table's sort</li>
|
||
|
<li class=fn>TQString <a href="#trueText-prop"><b>trueText</b></a> - the text used to represent true values</li>
|
||
|
</ul>
|
||
|
<h2>Protected Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn>virtual bool <a href="#insertCurrent"><b>insertCurrent</b></a> ()</li>
|
||
|
<li class=fn>virtual bool <a href="#updateCurrent"><b>updateCurrent</b></a> ()</li>
|
||
|
<li class=fn>virtual bool <a href="#deleteCurrent"><b>deleteCurrent</b></a> ()</li>
|
||
|
<li class=fn>virtual TQSql::Confirm <a href="#confirmEdit"><b>confirmEdit</b></a> ( TQSql::Op m )</li>
|
||
|
<li class=fn>virtual TQSql::Confirm <a href="#confirmCancel"><b>confirmCancel</b></a> ( TQSql::Op m )</li>
|
||
|
<li class=fn>virtual void <a href="#handleError"><b>handleError</b></a> ( const TQSqlError & e )</li>
|
||
|
<li class=fn>virtual bool <a href="#beginInsert"><b>beginInsert</b></a> ()</li>
|
||
|
<li class=fn>virtual TQWidget * <a href="#beginUpdate"><b>beginUpdate</b></a> ( int row, int col, bool replace )</li>
|
||
|
<li class=fn>int <a href="#indexOf"><b>indexOf</b></a> ( uint i ) const</li>
|
||
|
<li class=fn>void <a href="#reset"><b>reset</b></a> ()</li>
|
||
|
<li class=fn>void <a href="#setSize"><b>setSize</b></a> ( TQSqlCursor * sql )</li>
|
||
|
<li class=fn>virtual void <a href="#paintField"><b>paintField</b></a> ( TQPainter * p, const TQSqlField * field, const TQRect & cr, bool selected )</li>
|
||
|
<li class=fn>virtual int <a href="#fieldAlignment"><b>fieldAlignment</b></a> ( const TQSqlField * field )</li>
|
||
|
</ul>
|
||
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
||
|
|
||
|
|
||
|
The TQDataTable class provides a flexible SQL table widget that supports browsing and editing.
|
||
|
<p>
|
||
|
|
||
|
|
||
|
<p> TQDataTable supports various functions for presenting and editing
|
||
13 years ago
|
SQL data from a <a href="ntqsqlcursor.html">TQSqlCursor</a> in a table.
|
||
|
<p> If you want a to present your data in a form use <a href="ntqdatabrowser.html">TQDataBrowser</a>, or
|
||
|
for read-only forms, <a href="ntqdataview.html">TQDataView</a>.
|
||
13 years ago
|
<p> When displaying data, TQDataTable only retrieves data for visible
|
||
|
rows. If the driver supports the 'query size' property the
|
||
|
TQDataTable will have the correct number of rows and the vertical
|
||
|
scrollbar will accurately reflect the number of rows displayed in
|
||
|
proportion to the number of rows in the dataset. If the driver
|
||
|
does not support the 'query size' property, rows are dynamically
|
||
|
fetched from the database on an as-needed basis with the scrollbar
|
||
|
becoming more accurate as the user scrolls down through the
|
||
|
records. This allows extremely large queries to be displayed as
|
||
|
tquickly as possible, with minimum memory usage.
|
||
13 years ago
|
<p> TQDataTable inherits <a href="ntqtable.html">TQTable</a>'s API and extends it with functions to
|
||
13 years ago
|
sort and filter the data and sort columns. See <a href="#setSqlCursor">setSqlCursor</a>(),
|
||
13 years ago
|
<a href="#setFilter">setFilter</a>(), <a href="#setSort">setSort</a>(), <a href="ntqtable.html#setSorting">setSorting</a>(), <a href="#sortColumn">sortColumn</a>() and <a href="#refresh">refresh</a>().
|
||
13 years ago
|
<p> When displaying editable cursors, cell editing will be enabled.
|
||
13 years ago
|
(For more information on editable cursors, see <a href="ntqsqlcursor.html">TQSqlCursor</a>).
|
||
13 years ago
|
TQDataTable can be used to modify existing data and to add new
|
||
|
records. When a user makes changes to a field in the table, the
|
||
|
cursor's edit buffer is used. The table will not send changes in
|
||
|
the edit buffer to the database until the user moves to a
|
||
|
different record in the grid or presses Enter. Cell editing is
|
||
|
initiated by pressing F2 (or right clicking and then clicking the
|
||
|
appropriate popup menu item) and canceled by pressing Esc. If
|
||
|
there is a problem updating or adding data, errors are handled
|
||
|
automatically (see <a href="#handleError">handleError</a>() to change this behavior). Note
|
||
|
that if <a href="#autoEdit">autoEdit</a>() is FALSE navigating to another record will
|
||
|
cancel the insert or update.
|
||
|
<p> The user can be asked to confirm all edits with <a href="#setConfirmEdits">setConfirmEdits</a>().
|
||
|
For more precise control use <a href="#setConfirmInsert">setConfirmInsert</a>(),
|
||
|
<a href="#setConfirmUpdate">setConfirmUpdate</a>(), <a href="#setConfirmDelete">setConfirmDelete</a>() and <a href="#setConfirmCancels">setConfirmCancels</a>().
|
||
|
Use <a href="#setAutoEdit">setAutoEdit</a>() to control the behaviour of the table when the
|
||
|
user edits a record and then navigates. (Note that <a href="#setAutoDelete">setAutoDelete</a>()
|
||
13 years ago
|
is unrelated; it is used to set whether the <a href="ntqsqlcursor.html">TQSqlCursor</a> is deleted
|
||
13 years ago
|
when the table is deleted.)
|
||
|
<p> Since the data table can perform edits, it must be able to
|
||
|
uniquely identify every record so that edits are correctly
|
||
|
applied. Because of this the underlying cursor must have a valid
|
||
|
primary index to ensure that a unique record is inserted, updated
|
||
|
or deleted within the database otherwise the database may be
|
||
|
changed to an inconsistent state.
|
||
13 years ago
|
<p> TQDataTable creates editors using the default <a href="ntqsqleditorfactory.html">TQSqlEditorFactory</a>.
|
||
13 years ago
|
Different editor factories can be used by calling
|
||
|
<a href="#installEditorFactory">installEditorFactory</a>(). A property map is used to map between the
|
||
|
cell's value and the editor. You can use your own property map
|
||
|
with <a href="#installPropertyMap">installPropertyMap</a>().
|
||
13 years ago
|
<p> The contents of a cell is available as a <a href="ntqstring.html">TQString</a> with <a href="#text">text</a>() or as
|
||
|
a <a href="ntqvariant.html">TQVariant</a> with <a href="#value">value</a>(). The current record is returned by
|
||
13 years ago
|
<a href="#currentRecord">currentRecord</a>(). Use the <a href="#find">find</a>() function to search for a string in
|
||
|
the table.
|
||
|
<p> Editing actions can be applied programatically. For example, the
|
||
|
<a href="#insertCurrent">insertCurrent</a>() function reads the fields from the current record
|
||
|
into the cursor and performs the insert. The <a href="#updateCurrent">updateCurrent</a>() and
|
||
|
<a href="#deleteCurrent">deleteCurrent</a>() functions perform similarly to update and delete
|
||
|
the current record respectively.
|
||
|
<p> Columns in the table can be created automatically based on the
|
||
|
cursor (see <a href="#setSqlCursor">setSqlCursor</a>()). Columns can be manipulated manually
|
||
|
using <a href="#addColumn">addColumn</a>(), <a href="#removeColumn">removeColumn</a>() and <a href="#setColumn">setColumn</a>().
|
||
|
<p> The table automatically copies many of the properties of the
|
||
|
cursor to format the display of data within cells (alignment,
|
||
|
visibility, etc.). The cursor can be changed with setSqlCursor().
|
||
|
The filter (see <a href="#setFilter">setFilter</a>()) and sort defined within the table are
|
||
|
used instead of the filter and sort set on the cursor. For sorting
|
||
|
options see <a href="#setSort">setSort</a>(), <a href="#sortColumn">sortColumn</a>(), <a href="#sortAscending">sortAscending</a>() and
|
||
|
<a href="#sortDescending">sortDescending</a>(). Note that sorting operations will not behave as
|
||
13 years ago
|
expected if you are using a <a href="ntqsqlselectcursor.html">TQSqlSelectCursor</a> because it uses
|
||
13 years ago
|
user-defined SQL queries to obtain data.
|
||
|
<p> The text used to represent NULL, TRUE and FALSE values can be
|
||
|
changed with <a href="#setNullText">setNullText</a>(), <a href="#setTrueText">setTrueText</a>() and <a href="#setFalseText">setFalseText</a>()
|
||
|
respectively. You can change the appearance of cells by
|
||
|
reimplementing <a href="#paintField">paintField</a>().
|
||
|
<p> Whenever a new row is selected in the table the <a href="#currentChanged">currentChanged</a>()
|
||
|
signal is emitted. The <a href="#primeInsert">primeInsert</a>() signal is emitted when an
|
||
|
insert is initiated. The <a href="#primeUpdate">primeUpdate</a>() and <a href="#primeDelete">primeDelete</a>() signals
|
||
|
are emitted when update and deletion are initiated respectively.
|
||
|
Just before the database is updated a signal is emitted;
|
||
|
<a href="#beforeInsert">beforeInsert</a>(), <a href="#beforeUpdate">beforeUpdate</a>() or <a href="#beforeDelete">beforeDelete</a>() as appropriate.
|
||
|
<p> <p>See also <a href="database.html">Database Classes</a>.
|
||
|
|
||
|
<hr><h2>Member Type Documentation</h2>
|
||
|
<h3 class=fn><a name="Refresh-enum"></a>TQDataTable::Refresh</h3>
|
||
|
|
||
|
<p> This enum describes the refresh options.
|
||
|
<ul>
|
||
|
<li><tt>TQDataTable::RefreshData</tt> - refresh the data, i.e. read it from the database
|
||
|
<li><tt>TQDataTable::RefreshColumns</tt> - refresh the list of fields, e.g. the column headings
|
||
|
<li><tt>TQDataTable::RefreshAll</tt> - refresh both the data and the list of fields
|
||
|
</ul>
|
||
|
<hr><h2>Member Function Documentation</h2>
|
||
13 years ago
|
<h3 class=fn><a name="TQDataTable"></a>TQDataTable::TQDataTable ( <a href="ntqwidget.html">TQWidget</a> * parent = 0, const char * name = 0 )
|
||
13 years ago
|
</h3>
|
||
|
Constructs a data table which is a child of <em>parent</em>, called
|
||
|
name <em>name</em>.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a name="TQDataTable-2"></a>TQDataTable::TQDataTable ( <a href="ntqsqlcursor.html">TQSqlCursor</a> * cursor, bool autoPopulate = FALSE, <a href="ntqwidget.html">TQWidget</a> * parent = 0, const char * name = 0 )
|
||
13 years ago
|
</h3>
|
||
|
Constructs a data table which is a child of <em>parent</em>, called name
|
||
|
<em>name</em> using the cursor <em>cursor</em>.
|
||
|
<p> If <em>autoPopulate</em> is TRUE (the default is FALSE), columns are
|
||
|
automatically created based upon the fields in the <em>cursor</em>
|
||
|
record. Note that <em>autoPopulate</em> only governs the creation of
|
||
|
columns; to load the cursor's data into the table use <a href="#refresh">refresh</a>().
|
||
|
<p> If the <em>cursor</em> is read-only, the table also becomes read-only.
|
||
|
In addition, the table adopts the cursor's driver's definition for
|
||
|
representing NULL values as strings.
|
||
|
|
||
|
<h3 class=fn><a name="~TQDataTable"></a>TQDataTable::~TQDataTable ()
|
||
|
</h3>
|
||
|
Destroys the object and frees any allocated resources.
|
||
|
|
||
13 years ago
|
<h3 class=fn>void <a name="addColumn"></a>TQDataTable::addColumn ( const <a href="ntqstring.html">TQString</a> & fieldName, const <a href="ntqstring.html">TQString</a> & label = TQString::null, int width = -1, const <a href="ntqiconset.html">TQIconSet</a> & iconset = TQIconSet ( ) )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3>
|
||
|
Adds the next column to be displayed using the field <em>fieldName</em>,
|
||
|
column label <em>label</em>, width <em>width</em> and iconset <em>iconset</em>.
|
||
|
<p> If <em>label</em> is specified, it is used as the column's header label,
|
||
|
otherwise the field's display label is used when <a href="#setSqlCursor">setSqlCursor</a>() is
|
||
|
called. The <em>iconset</em> is used to set the icon used by the column
|
||
|
header; by default there is no icon.
|
||
|
<p> <p>See also <a href="#setSqlCursor">setSqlCursor</a>() and <a href="#refresh">refresh</a>().
|
||
|
|
||
|
<p>Examples: <a href="sql.html#x2255">sql/overview/subclass1/main.cpp</a>, <a href="sql.html#x2258">sql/overview/subclass3/main.cpp</a>, <a href="sql.html#x2214">sql/overview/table2/main.cpp</a>, and <a href="sqltable-example.html#x2451">sql/sqltable/main.cpp</a>.
|
||
|
<h3 class=fn>void <a name="adjustColumn"></a>TQDataTable::adjustColumn ( int col )<tt> [virtual slot]</tt>
|
||
|
</h3>
|
||
|
Resizes column <em>col</em> so that the column width is wide enough to
|
||
|
display the widest item the column contains (including the column
|
||
13 years ago
|
label). If the table's <a href="ntqsqlcursor.html">TQSqlCursor</a> is not currently active, the
|
||
13 years ago
|
cursor will be refreshed before the column width is calculated. Be
|
||
|
aware that this function may be slow on tables that contain large
|
||
|
result sets.
|
||
|
|
||
13 years ago
|
<p>Reimplemented from <a href="ntqtable.html#adjustColumn">TQTable</a>.
|
||
13 years ago
|
<h3 class=fn>bool <a name="autoDelete"></a>TQDataTable::autoDelete () const
|
||
|
</h3>
|
||
|
Returns TRUE if the table will automatically delete the cursor
|
||
|
specified by <a href="#setSqlCursor">setSqlCursor</a>(); otherwise returns FALSE.
|
||
|
|
||
|
<h3 class=fn>bool <a name="autoEdit"></a>TQDataTable::autoEdit () const
|
||
|
</h3><p>Returns TRUE if the data table automatically applies edits; otherwise returns FALSE.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#autoEdit-prop">"autoEdit"</a> property for details.
|
||
|
<h3 class=fn>void <a name="beforeDelete"></a>TQDataTable::beforeDelete ( <a href="ntqsqlrecord.html">TQSqlRecord</a> * buf )<tt> [signal]</tt>
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> This signal is emitted just before the currently selected record
|
||
|
is deleted from the database. The <em>buf</em> parameter points to the
|
||
|
edit buffer being deleted. Connect to this signal to, for example,
|
||
|
copy some of the fields for later use.
|
||
|
|
||
13 years ago
|
<h3 class=fn>void <a name="beforeInsert"></a>TQDataTable::beforeInsert ( <a href="ntqsqlrecord.html">TQSqlRecord</a> * buf )<tt> [signal]</tt>
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> This signal is emitted just before the cursor's edit buffer is
|
||
|
inserted into the database. The <em>buf</em> parameter points to the
|
||
|
edit buffer being inserted. Connect to this signal to, for
|
||
|
example, populate a key field with a unique sequence number.
|
||
|
|
||
13 years ago
|
<h3 class=fn>void <a name="beforeUpdate"></a>TQDataTable::beforeUpdate ( <a href="ntqsqlrecord.html">TQSqlRecord</a> * buf )<tt> [signal]</tt>
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> This signal is emitted just before the cursor's edit buffer is
|
||
|
updated in the database. The <em>buf</em> parameter points to the edit
|
||
|
buffer being updated. Connect to this signal when you want to
|
||
|
transform the user's data behind-the-scenes.
|
||
|
|
||
|
<h3 class=fn>bool <a name="beginInsert"></a>TQDataTable::beginInsert ()<tt> [virtual protected]</tt>
|
||
|
</h3>
|
||
|
Protected virtual function called when editing is about to begin
|
||
|
on a new record. If the table is read-only, or if there's no
|
||
|
cursor or the cursor does not allow inserts, nothing happens.
|
||
|
<p> Editing takes place using the cursor's edit buffer(see
|
||
13 years ago
|
<a href="ntqsqlcursor.html#editBuffer">TQSqlCursor::editBuffer</a>()).
|
||
13 years ago
|
<p> When editing begins, a new row is created in the table marked with
|
||
|
an asterisk '*' in the row's vertical header column, i.e. at the
|
||
|
left of the row.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqwidget.html">TQWidget</a> * <a name="beginUpdate"></a>TQDataTable::beginUpdate ( int row, int col, bool replace )<tt> [virtual protected]</tt>
|
||
13 years ago
|
</h3>
|
||
|
Protected virtual function called when editing is about to begin
|
||
|
on an existing row. If the table is read-only, or if there's no
|
||
|
cursor, nothing happens.
|
||
|
<p> Editing takes place using the cursor's edit buffer (see
|
||
13 years ago
|
<a href="ntqsqlcursor.html#editBuffer">TQSqlCursor::editBuffer</a>()).
|
||
13 years ago
|
<p> <em>row</em> and <em>col</em> refer to the row and column in the TQDataTable.
|
||
|
<p> (<em>replace</em> is provided for reimplementors and reflects the API of
|
||
13 years ago
|
<a href="ntqtable.html#beginEdit">TQTable::beginEdit</a>().)
|
||
13 years ago
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqsql.html#Confirm-enum">TQSql::Confirm</a> <a name="confirmCancel"></a>TQDataTable::confirmCancel ( <a href="ntqsql.html#Op-enum">TQSql::Op</a> m )<tt> [virtual protected]</tt>
|
||
13 years ago
|
</h3>
|
||
|
Protected virtual function which returns a confirmation for
|
||
|
cancelling an edit mode of <em>m</em>. Derived classes can reimplement
|
||
|
this function to provide their own cancel dialog. The default
|
||
|
implementation uses a message box which prompts the user to
|
||
|
confirm the cancel.
|
||
|
|
||
|
<h3 class=fn>bool <a name="confirmCancels"></a>TQDataTable::confirmCancels () const
|
||
|
</h3><p>Returns TRUE if the data table confirms cancel operations; otherwise returns FALSE.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#confirmCancels-prop">"confirmCancels"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>bool <a name="confirmDelete"></a>TQDataTable::confirmDelete () const
|
||
|
</h3><p>Returns TRUE if the data table confirms delete operations; otherwise returns FALSE.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#confirmDelete-prop">"confirmDelete"</a> property for details.
|
||
|
<h3 class=fn><a href="ntqsql.html#Confirm-enum">TQSql::Confirm</a> <a name="confirmEdit"></a>TQDataTable::confirmEdit ( <a href="ntqsql.html#Op-enum">TQSql::Op</a> m )<tt> [virtual protected]</tt>
|
||
13 years ago
|
</h3>
|
||
|
Protected virtual function which returns a confirmation for an
|
||
|
edit of mode <em>m</em>. Derived classes can reimplement this function
|
||
|
to provide their own confirmation dialog. The default
|
||
|
implementation uses a message box which prompts the user to
|
||
|
confirm the edit action.
|
||
|
|
||
|
<h3 class=fn>bool <a name="confirmEdits"></a>TQDataTable::confirmEdits () const
|
||
|
</h3><p>Returns TRUE if the data table confirms edit operations; otherwise returns FALSE.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#confirmEdits-prop">"confirmEdits"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>bool <a name="confirmInsert"></a>TQDataTable::confirmInsert () const
|
||
|
</h3><p>Returns TRUE if the data table confirms insert operations; otherwise returns FALSE.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#confirmInsert-prop">"confirmInsert"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>bool <a name="confirmUpdate"></a>TQDataTable::confirmUpdate () const
|
||
|
</h3><p>Returns TRUE if the data table confirms update operations; otherwise returns FALSE.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#confirmUpdate-prop">"confirmUpdate"</a> property for details.
|
||
|
<h3 class=fn>void <a name="currentChanged"></a>TQDataTable::currentChanged ( <a href="ntqsqlrecord.html">TQSqlRecord</a> * record )<tt> [signal]</tt>
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> This signal is emitted whenever a new row is selected in the
|
||
|
table. The <em>record</em> parameter points to the contents of the newly
|
||
|
selected record.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqsqlrecord.html">TQSqlRecord</a> * <a name="currentRecord"></a>TQDataTable::currentRecord () const
|
||
13 years ago
|
</h3>
|
||
|
Returns the currently selected record, or 0 if there is no current
|
||
|
selection. The table owns the pointer, so do <em>not</em> delete it or
|
||
|
otherwise modify it or the cursor it points to.
|
||
|
|
||
13 years ago
|
<h3 class=fn>void <a name="cursorChanged"></a>TQDataTable::cursorChanged ( <a href="ntqsql.html#Op-enum">TQSql::Op</a> mode )<tt> [signal]</tt>
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> This signal is emitted whenever the cursor record was changed due
|
||
|
to an edit. The <em>mode</em> parameter is the type of edit that just
|
||
|
took place.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqt.html#DateFormat-enum">DateFormat</a> <a name="dateFormat"></a>TQDataTable::dateFormat () const
|
||
13 years ago
|
</h3><p>Returns the format used for displaying date/time values.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#dateFormat-prop">"dateFormat"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>bool <a name="deleteCurrent"></a>TQDataTable::deleteCurrent ()<tt> [virtual protected]</tt>
|
||
|
</h3>
|
||
|
For an editable table, issues a delete on the current cursor's
|
||
|
primary index using the values of the currently selected row. If
|
||
|
there is no current cursor or there is no current selection,
|
||
|
nothing happens. If <a href="#confirmEdits">confirmEdits</a>() or <a href="#confirmDelete">confirmDelete</a>() is TRUE,
|
||
|
<a href="#confirmEdit">confirmEdit</a>() is called to confirm the delete. Returns TRUE if the
|
||
|
delete succeeded; otherwise FALSE.
|
||
|
<p> The underlying cursor must have a valid primary index to ensure
|
||
|
that a unique record is deleted within the database otherwise the
|
||
|
database may be changed to an inconsistent state.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="falseText"></a>TQDataTable::falseText () const
|
||
13 years ago
|
</h3><p>Returns the text used to represent false values.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#falseText-prop">"falseText"</a> property for details.
|
||
|
<h3 class=fn>int <a name="fieldAlignment"></a>TQDataTable::fieldAlignment ( const <a href="ntqsqlfield.html">TQSqlField</a> * field )<tt> [virtual protected]</tt>
|
||
13 years ago
|
</h3>
|
||
|
Returns the alignment for <em>field</em>.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="filter"></a>TQDataTable::filter () const
|
||
13 years ago
|
</h3><p>Returns the data filter for the data table.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#filter-prop">"filter"</a> property for details.
|
||
|
<h3 class=fn>void <a name="find"></a>TQDataTable::find ( const <a href="ntqstring.html">TQString</a> & str, bool caseSensitive, bool backwards )<tt> [virtual slot]</tt>
|
||
13 years ago
|
</h3>
|
||
|
Searches the current cursor for a cell containing the string <em>str</em> starting at the current cell and working forwards (or
|
||
|
backwards if <em>backwards</em> is TRUE). If the string is found, the
|
||
|
cell containing the string is set as the current cell. If <em>caseSensitive</em> is FALSE the case of <em>str</em> will be ignored.
|
||
|
<p> The search will wrap, i.e. if the first (or if backwards is TRUE,
|
||
|
last) cell is reached without finding <em>str</em> the search will
|
||
|
continue until it reaches the starting cell. If <em>str</em> is not
|
||
|
found the search will fail and the current cell will remain
|
||
|
unchanged.
|
||
|
|
||
13 years ago
|
<h3 class=fn>void <a name="handleError"></a>TQDataTable::handleError ( const <a href="ntqsqlerror.html">TQSqlError</a> & e )<tt> [virtual protected]</tt>
|
||
13 years ago
|
</h3>
|
||
|
Protected virtual function which is called when an error <em>e</em> has
|
||
13 years ago
|
occurred on the current <a href="ntqwidget.html#cursor">cursor</a>(). The default implementation
|
||
13 years ago
|
displays a warning message to the user with information about the
|
||
|
error.
|
||
|
|
||
|
<h3 class=fn>int <a name="indexOf"></a>TQDataTable::indexOf ( uint i ) const<tt> [protected]</tt>
|
||
|
</h3>
|
||
|
Returns the index of the field within the current SQL query that
|
||
|
is displayed in column <em>i</em>.
|
||
|
|
||
|
<h3 class=fn>bool <a name="insertCurrent"></a>TQDataTable::insertCurrent ()<tt> [virtual protected]</tt>
|
||
|
</h3>
|
||
|
For an editable table, issues an insert on the current cursor
|
||
|
using the values in the cursor's edit buffer. If there is no
|
||
|
current cursor or there is no current "insert" row, nothing
|
||
|
happens. If <a href="#confirmEdits">confirmEdits</a>() or <a href="#confirmInsert">confirmInsert</a>() is TRUE,
|
||
|
<a href="#confirmEdit">confirmEdit</a>() is called to confirm the insert. Returns TRUE if the
|
||
|
insert succeeded; otherwise returns FALSE.
|
||
|
<p> The underlying cursor must have a valid primary index to ensure
|
||
|
that a unique record is inserted within the database otherwise the
|
||
|
database may be changed to an inconsistent state.
|
||
|
|
||
13 years ago
|
<h3 class=fn>void <a name="installEditorFactory"></a>TQDataTable::installEditorFactory ( <a href="ntqsqleditorfactory.html">TQSqlEditorFactory</a> * f )
|
||
13 years ago
|
</h3>
|
||
|
Installs a new SQL editor factory <em>f</em>. This enables the user to
|
||
|
create and instantiate their own editors for use in cell editing.
|
||
|
Note that TQDataTable takes ownership of this pointer, and will
|
||
|
delete it when it is no longer needed or when
|
||
|
<a href="#installEditorFactory">installEditorFactory</a>() is called again.
|
||
13 years ago
|
<p> <p>See also <a href="ntqsqleditorfactory.html">TQSqlEditorFactory</a>.
|
||
13 years ago
|
|
||
13 years ago
|
<h3 class=fn>void <a name="installPropertyMap"></a>TQDataTable::installPropertyMap ( <a href="ntqsqlpropertymap.html">TQSqlPropertyMap</a> * m )
|
||
13 years ago
|
</h3>
|
||
|
Installs a new property map <em>m</em>. This enables the user to create
|
||
|
and instantiate their own property maps for use in cell editing.
|
||
|
Note that TQDataTable takes ownership of this pointer, and will
|
||
|
delete it when it is no longer needed or when installPropertMap()
|
||
|
is called again.
|
||
13 years ago
|
<p> <p>See also <a href="ntqsqlpropertymap.html">TQSqlPropertyMap</a>.
|
||
13 years ago
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="nullText"></a>TQDataTable::nullText () const
|
||
13 years ago
|
</h3><p>Returns the text used to represent NULL values.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#nullText-prop">"nullText"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>int <a name="numCols"></a>TQDataTable::numCols () const<tt> [virtual]</tt>
|
||
|
</h3><p>Returns the number of columns in the table.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#numCols-prop">"numCols"</a> property for details.
|
||
|
<p>Reimplemented from <a href="ntqtable.html#numCols">TQTable</a>.
|
||
13 years ago
|
<h3 class=fn>int <a name="numRows"></a>TQDataTable::numRows () const<tt> [virtual]</tt>
|
||
|
</h3><p>Returns the number of rows in the table.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#numRows-prop">"numRows"</a> property for details.
|
||
|
<p>Reimplemented from <a href="ntqtable.html#numRows">TQTable</a>.
|
||
|
<h3 class=fn>void <a name="paintField"></a>TQDataTable::paintField ( <a href="ntqpainter.html">TQPainter</a> * p, const <a href="ntqsqlfield.html">TQSqlField</a> * field, const <a href="ntqrect.html">TQRect</a> & cr, bool selected )<tt> [virtual protected]</tt>
|
||
13 years ago
|
</h3>
|
||
|
Paints the <em>field</em> on the painter <em>p</em>. The painter has already
|
||
|
been translated to the appropriate cell's origin where the <em>field</em> is to be rendered. <em>cr</em> describes the cell coordinates in
|
||
|
the content coordinate system. The <em>selected</em> parameter is
|
||
|
ignored.
|
||
|
<p> If you want to draw custom field content you must reimplement
|
||
|
<a href="#paintField">paintField</a>() to do the custom drawing. The default implementation
|
||
|
renders the <em>field</em> value as text. If the field is NULL,
|
||
|
<a href="#nullText">nullText</a>() is displayed in the cell. If the field is Boolean,
|
||
|
<a href="#trueText">trueText</a>() or <a href="#falseText">falseText</a>() is displayed as appropriate.
|
||
|
|
||
|
<p>Example: <a href="sql.html#x2245">sql/overview/table4/main.cpp</a>.
|
||
13 years ago
|
<h3 class=fn>void <a name="primeDelete"></a>TQDataTable::primeDelete ( <a href="ntqsqlrecord.html">TQSqlRecord</a> * buf )<tt> [signal]</tt>
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> This signal is emitted after the cursor is primed for delete by
|
||
|
the table, when a delete action is beginning on the table. The <em>buf</em> parameter points to the edit buffer being deleted. Connect to
|
||
|
this signal in order to, for example, record auditing information
|
||
|
on deletions.
|
||
|
|
||
13 years ago
|
<h3 class=fn>void <a name="primeInsert"></a>TQDataTable::primeInsert ( <a href="ntqsqlrecord.html">TQSqlRecord</a> * buf )<tt> [signal]</tt>
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> This signal is emitted after the cursor is primed for insert by
|
||
|
the table, when an insert action is beginning on the table. The <em>buf</em> parameter points to the edit buffer being inserted. Connect to
|
||
|
this signal in order to, for example, <a href="primes.html#prime">prime</a> the record buffer with
|
||
|
default data values.
|
||
|
|
||
13 years ago
|
<h3 class=fn>void <a name="primeUpdate"></a>TQDataTable::primeUpdate ( <a href="ntqsqlrecord.html">TQSqlRecord</a> * buf )<tt> [signal]</tt>
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> This signal is emitted after the cursor is primed for update by
|
||
|
the table, when an update action is beginning on the table. The <em>buf</em> parameter points to the edit buffer being updated. Connect to
|
||
|
this signal in order to, for example, provide some visual feedback
|
||
|
that the user is in 'edit mode'.
|
||
|
|
||
|
<h3 class=fn>void <a name="refresh"></a>TQDataTable::refresh ()<tt> [virtual slot]</tt>
|
||
|
</h3>
|
||
|
Refreshes the table. The cursor is refreshed using the current
|
||
|
filter, the current sort, and the currently defined columns.
|
||
|
Equivalent to calling <a href="#refresh">refresh</a>( TQDataTable::RefreshData ).
|
||
|
|
||
|
<p>Examples: <a href="sql.html#x2256">sql/overview/subclass1/main.cpp</a>, <a href="sql.html#x2211">sql/overview/table1/main.cpp</a>, <a href="sql.html#x2215">sql/overview/table2/main.cpp</a>, and <a href="sqltable-example.html#x2452">sql/sqltable/main.cpp</a>.
|
||
13 years ago
|
<h3 class=fn>void <a name="refresh-2"></a>TQDataTable::refresh ( <a href="ntqdatatable.html#Refresh-enum">Refresh</a> mode )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Refreshes the table. If there is no currently defined cursor (see
|
||
|
<a href="#setSqlCursor">setSqlCursor</a>()), nothing happens. The <em>mode</em> parameter determines
|
||
|
which type of refresh will take place.
|
||
|
<p> <p>See also <a href="#Refresh-enum">Refresh</a>, <a href="#setSqlCursor">setSqlCursor</a>(), and <a href="#addColumn">addColumn</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="removeColumn"></a>TQDataTable::removeColumn ( uint col )<tt> [virtual]</tt>
|
||
|
</h3>
|
||
|
Removes column <em>col</em> from the list of columns to be displayed. If
|
||
|
<em>col</em> does not exist, nothing happens.
|
||
13 years ago
|
<p> <p>See also <a href="ntqsqlfield.html">TQSqlField</a>.
|
||
13 years ago
|
|
||
|
<h3 class=fn>void <a name="reset"></a>TQDataTable::reset ()<tt> [protected]</tt>
|
||
|
</h3>
|
||
|
Resets the table so that it displays no data.
|
||
|
<p> <p>See also <a href="#setSqlCursor">setSqlCursor</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="setAutoDelete"></a>TQDataTable::setAutoDelete ( bool enable )<tt> [virtual]</tt>
|
||
|
</h3>
|
||
|
Sets the cursor auto-delete flag to <em>enable</em>. If <em>enable</em> is
|
||
|
TRUE, the table will automatically delete the cursor specified by
|
||
|
<a href="#setSqlCursor">setSqlCursor</a>(). If <em>enable</em> is FALSE (the default), the cursor
|
||
|
will not be deleted.
|
||
|
|
||
|
<h3 class=fn>void <a name="setAutoEdit"></a>TQDataTable::setAutoEdit ( bool autoEdit )<tt> [virtual]</tt>
|
||
|
</h3><p>Sets whether the data table automatically applies edits to <em>autoEdit</em>.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#autoEdit-prop">"autoEdit"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setColumn"></a>TQDataTable::setColumn ( uint col, const <a href="ntqstring.html">TQString</a> & fieldName, const <a href="ntqstring.html">TQString</a> & label = TQString::null, int width = -1, const <a href="ntqiconset.html">TQIconSet</a> & iconset = TQIconSet ( ) )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3>
|
||
|
Sets the <em>col</em> column to display using the field <em>fieldName</em>,
|
||
|
column label <em>label</em>, width <em>width</em> and iconset <em>iconset</em>.
|
||
|
<p> If <em>label</em> is specified, it is used as the column's header label,
|
||
|
otherwise the field's display label is used when <a href="#setSqlCursor">setSqlCursor</a>() is
|
||
|
called. The <em>iconset</em> is used to set the icon used by the column
|
||
|
header; by default there is no icon.
|
||
|
<p> <p>See also <a href="#setSqlCursor">setSqlCursor</a>() and <a href="#refresh">refresh</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="setColumnWidth"></a>TQDataTable::setColumnWidth ( int col, int w )<tt> [virtual slot]</tt>
|
||
|
</h3>
|
||
13 years ago
|
Sets the column <em>col</em> to the width <em>w</em>. Note that unlike <a href="ntqtable.html">TQTable</a>
|
||
13 years ago
|
the TQDataTable is not immediately redrawn, you must call
|
||
|
<a href="#refresh">refresh</a>(TQDataTable::RefreshColumns)
|
||
|
yourself.
|
||
|
<p> <p>See also <a href="#refresh">refresh</a>().
|
||
|
|
||
13 years ago
|
<p>Reimplemented from <a href="ntqtable.html#setColumnWidth">TQTable</a>.
|
||
13 years ago
|
<h3 class=fn>void <a name="setConfirmCancels"></a>TQDataTable::setConfirmCancels ( bool confirm )<tt> [virtual]</tt>
|
||
|
</h3><p>Sets whether the data table confirms cancel operations to <em>confirm</em>.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#confirmCancels-prop">"confirmCancels"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="setConfirmDelete"></a>TQDataTable::setConfirmDelete ( bool confirm )<tt> [virtual]</tt>
|
||
|
</h3><p>Sets whether the data table confirms delete operations to <em>confirm</em>.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#confirmDelete-prop">"confirmDelete"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="setConfirmEdits"></a>TQDataTable::setConfirmEdits ( bool confirm )<tt> [virtual]</tt>
|
||
|
</h3><p>Sets whether the data table confirms edit operations to <em>confirm</em>.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#confirmEdits-prop">"confirmEdits"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="setConfirmInsert"></a>TQDataTable::setConfirmInsert ( bool confirm )<tt> [virtual]</tt>
|
||
|
</h3><p>Sets whether the data table confirms insert operations to <em>confirm</em>.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#confirmInsert-prop">"confirmInsert"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="setConfirmUpdate"></a>TQDataTable::setConfirmUpdate ( bool confirm )<tt> [virtual]</tt>
|
||
|
</h3><p>Sets whether the data table confirms update operations to <em>confirm</em>.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#confirmUpdate-prop">"confirmUpdate"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setDateFormat"></a>TQDataTable::setDateFormat ( const <a href="ntqt.html#DateFormat-enum">DateFormat</a> f )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3><p>Sets the format used for displaying date/time values to <em>f</em>.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#dateFormat-prop">"dateFormat"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setFalseText"></a>TQDataTable::setFalseText ( const <a href="ntqstring.html">TQString</a> & falseText )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3><p>Sets the text used to represent false values to <em>falseText</em>.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#falseText-prop">"falseText"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setFilter"></a>TQDataTable::setFilter ( const <a href="ntqstring.html">TQString</a> & filter )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3><p>Sets the data filter for the data table to <em>filter</em>.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#filter-prop">"filter"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setNullText"></a>TQDataTable::setNullText ( const <a href="ntqstring.html">TQString</a> & nullText )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3><p>Sets the text used to represent NULL values to <em>nullText</em>.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#nullText-prop">"nullText"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setSize"></a>TQDataTable::setSize ( <a href="ntqsqlcursor.html">TQSqlCursor</a> * sql )<tt> [protected]</tt>
|
||
13 years ago
|
</h3>
|
||
|
If the cursor's <em>sql</em> driver supports query sizes, the number of
|
||
|
rows in the table is set to the size of the query. Otherwise, the
|
||
|
table dynamically resizes itself as it is scrolled. If <em>sql</em> is
|
||
|
not active, it is made active by issuing a select() on the cursor
|
||
|
using the <em>sql</em> cursor's current filter and current sort.
|
||
|
|
||
13 years ago
|
<h3 class=fn>void <a name="setSort"></a>TQDataTable::setSort ( const <a href="ntqstringlist.html">TQStringList</a> & sort )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3><p>Sets the data table's sort to <em>sort</em>.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#sort-prop">"sort"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setSort-2"></a>TQDataTable::setSort ( const <a href="ntqsqlindex.html">TQSqlIndex</a> & sort )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Sets the sort to be applied to the displayed data to <em>sort</em>. If
|
||
13 years ago
|
there is no current cursor, nothing happens. A <a href="ntqsqlindex.html">TQSqlIndex</a> contains
|
||
13 years ago
|
field names and their ordering (ASC or DESC); these are used to
|
||
|
compose the ORDER BY clause.
|
||
|
<p> <p>See also <a href="#sort-prop">sort</a>.
|
||
|
|
||
13 years ago
|
<h3 class=fn>void <a name="setSqlCursor"></a>TQDataTable::setSqlCursor ( <a href="ntqsqlcursor.html">TQSqlCursor</a> * cursor = 0, bool autoPopulate = FALSE, bool autoDelete = FALSE )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3>
|
||
|
Sets <em>cursor</em> as the data source for the table. To force the
|
||
|
display of the data from <em>cursor</em>, use <a href="#refresh">refresh</a>(). If <em>autoPopulate</em> is TRUE, columns are automatically created based upon
|
||
|
the fields in the <em>cursor</em> record. If <em>autoDelete</em> is TRUE (the
|
||
|
default is FALSE), the table will take ownership of the <em>cursor</em>
|
||
|
and delete it when appropriate. If the <em>cursor</em> is read-only, the
|
||
|
table becomes read-only. The table adopts the cursor's driver's
|
||
|
definition for representing NULL values as strings.
|
||
13 years ago
|
<p> <p>See also <a href="#refresh">refresh</a>(), <a href="ntqtable.html#readOnly-prop">readOnly</a>, <a href="#setAutoDelete">setAutoDelete</a>(), and <a href="ntqsqldriver.html#nullText">TQSqlDriver::nullText</a>().
|
||
13 years ago
|
|
||
13 years ago
|
<h3 class=fn>void <a name="setTrueText"></a>TQDataTable::setTrueText ( const <a href="ntqstring.html">TQString</a> & trueText )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3><p>Sets the text used to represent true values to <em>trueText</em>.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#trueText-prop">"trueText"</a> property for details.
|
||
|
<h3 class=fn><a href="ntqstringlist.html">TQStringList</a> <a name="sort"></a>TQDataTable::sort () const
|
||
13 years ago
|
</h3><p>Returns the data table's sort.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#sort-prop">"sort"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="sortAscending"></a>TQDataTable::sortAscending ( int col )<tt> [virtual slot]</tt>
|
||
|
</h3>
|
||
|
Sorts column <em>col</em> in ascending order.
|
||
13 years ago
|
<p> <p>See also <a href="ntqtable.html#sorting-prop">sorting</a>.
|
||
13 years ago
|
|
||
|
<h3 class=fn>void <a name="sortColumn"></a>TQDataTable::sortColumn ( int col, bool ascending = TRUE, bool wholeRows = FALSE )<tt> [virtual]</tt>
|
||
|
</h3>
|
||
|
Sorts column <em>col</em> in ascending order if <em>ascending</em> is TRUE
|
||
|
(the default); otherwise sorts in descending order.
|
||
|
<p> The <em>wholeRows</em> parameter is ignored; TQDataTable always sorts
|
||
|
whole rows by the specified column.
|
||
|
|
||
13 years ago
|
<p>Reimplemented from <a href="ntqtable.html#sortColumn">TQTable</a>.
|
||
13 years ago
|
<h3 class=fn>void <a name="sortDescending"></a>TQDataTable::sortDescending ( int col )<tt> [virtual slot]</tt>
|
||
|
</h3>
|
||
|
Sorts column <em>col</em> in descending order.
|
||
13 years ago
|
<p> <p>See also <a href="ntqtable.html#sorting-prop">sorting</a>.
|
||
13 years ago
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqsqlcursor.html">TQSqlCursor</a> * <a name="sqlCursor"></a>TQDataTable::sqlCursor () const
|
||
13 years ago
|
</h3>
|
||
|
Returns the cursor used by the data table.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="text"></a>TQDataTable::text ( int row, int col ) const<tt> [virtual]</tt>
|
||
13 years ago
|
</h3>
|
||
|
Returns the text in cell <em>row</em>, <em>col</em>, or an empty string if the
|
||
|
cell is empty. If the cell's value is NULL then <a href="#nullText">nullText</a>() will be
|
||
13 years ago
|
returned. If the cell does not exist then <a href="ntqstring.html#TQString-null">TQString::null</a> is
|
||
13 years ago
|
returned.
|
||
|
|
||
13 years ago
|
<p>Reimplemented from <a href="ntqtable.html#text">TQTable</a>.
|
||
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="trueText"></a>TQDataTable::trueText () const
|
||
13 years ago
|
</h3><p>Returns the text used to represent true values.
|
||
13 years ago
|
See the <a href="ntqdatatable.html#trueText-prop">"trueText"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>bool <a name="updateCurrent"></a>TQDataTable::updateCurrent ()<tt> [virtual protected]</tt>
|
||
|
</h3>
|
||
|
For an editable table, issues an update using the cursor's edit
|
||
|
buffer. If there is no current cursor or there is no current
|
||
|
selection, nothing happens. If <a href="#confirmEdits">confirmEdits</a>() or <a href="#confirmUpdate">confirmUpdate</a>()
|
||
|
is TRUE, <a href="#confirmEdit">confirmEdit</a>() is called to confirm the update. Returns
|
||
|
TRUE if the update succeeded; otherwise returns FALSE.
|
||
|
<p> The underlying cursor must have a valid primary index to ensure
|
||
|
that a unique record is updated within the database otherwise the
|
||
|
database may be changed to an inconsistent state.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqvariant.html">TQVariant</a> <a name="value"></a>TQDataTable::value ( int row, int col ) const
|
||
13 years ago
|
</h3>
|
||
|
Returns the value in cell <em>row</em>, <em>col</em>, or an invalid value if
|
||
|
the cell does not exist or has no value.
|
||
|
|
||
|
<hr><h2>Property Documentation</h2>
|
||
|
<h3 class=fn>bool <a name="autoEdit-prop"></a>autoEdit</h3>
|
||
|
<p>This property holds whether the data table automatically applies edits.
|
||
|
<p>The default value for this property is TRUE. When the user begins
|
||
|
an insert or update in the table there are two possible outcomes
|
||
|
when they navigate to another record:
|
||
|
<p> <ol type=1>
|
||
|
<li> the insert or update is is performed -- this occurs if autoEdit is TRUE
|
||
|
<li> the insert or update is abandoned -- this occurs if autoEdit is FALSE
|
||
|
</ol>
|
||
|
|
||
|
<p>Set this property's value with <a href="#setAutoEdit">setAutoEdit</a>() and get this property's value with <a href="#autoEdit">autoEdit</a>().
|
||
|
<h3 class=fn>bool <a name="confirmCancels-prop"></a>confirmCancels</h3>
|
||
|
<p>This property holds whether the data table confirms cancel operations.
|
||
|
<p>If the confirmCancel property is TRUE, all cancels must be
|
||
|
confirmed by the user through a message box (this behavior can be
|
||
|
changed by overriding the <a href="#confirmCancel">confirmCancel</a>() function), otherwise all
|
||
|
cancels occur immediately. The default is FALSE.
|
||
|
<p> <p>See also <a href="#confirmEdits-prop">confirmEdits</a> and <a href="#confirmCancel">confirmCancel</a>().
|
||
|
|
||
|
<p>Set this property's value with <a href="#setConfirmCancels">setConfirmCancels</a>() and get this property's value with <a href="#confirmCancels">confirmCancels</a>().
|
||
|
<h3 class=fn>bool <a name="confirmDelete-prop"></a>confirmDelete</h3>
|
||
|
<p>This property holds whether the data table confirms delete operations.
|
||
|
<p>If the confirmDelete property is TRUE, all deletions must be
|
||
|
confirmed by the user through a message box (this behaviour can be
|
||
|
changed by overriding the <a href="#confirmEdit">confirmEdit</a>() function), otherwise all
|
||
|
delete operations occur immediately.
|
||
|
<p> <p>See also <a href="#confirmCancels-prop">confirmCancels</a>, <a href="#confirmEdits-prop">confirmEdits</a>, <a href="#confirmUpdate-prop">confirmUpdate</a>, and <a href="#confirmInsert-prop">confirmInsert</a>.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setConfirmDelete">setConfirmDelete</a>() and get this property's value with <a href="#confirmDelete">confirmDelete</a>().
|
||
|
<h3 class=fn>bool <a name="confirmEdits-prop"></a>confirmEdits</h3>
|
||
|
<p>This property holds whether the data table confirms edit operations.
|
||
|
<p>If the confirmEdits property is TRUE, the data table confirms all
|
||
|
edit operations (inserts, updates and deletes). Finer control of
|
||
|
edit confirmation can be achieved using <a href="#confirmCancels-prop">confirmCancels</a>, <a href="#confirmInsert-prop">confirmInsert</a>, <a href="#confirmUpdate-prop">confirmUpdate</a> and <a href="#confirmDelete-prop">confirmDelete</a>.
|
||
|
<p> <p>See also <a href="#confirmCancels-prop">confirmCancels</a>, <a href="#confirmInsert-prop">confirmInsert</a>, <a href="#confirmUpdate-prop">confirmUpdate</a>, and <a href="#confirmDelete-prop">confirmDelete</a>.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setConfirmEdits">setConfirmEdits</a>() and get this property's value with <a href="#confirmEdits">confirmEdits</a>().
|
||
|
<h3 class=fn>bool <a name="confirmInsert-prop"></a>confirmInsert</h3>
|
||
|
<p>This property holds whether the data table confirms insert operations.
|
||
|
<p>If the confirmInsert property is TRUE, all insertions must be
|
||
|
confirmed by the user through a message box (this behaviour can be
|
||
|
changed by overriding the <a href="#confirmEdit">confirmEdit</a>() function), otherwise all
|
||
|
insert operations occur immediately.
|
||
|
<p> <p>See also <a href="#confirmCancels-prop">confirmCancels</a>, <a href="#confirmEdits-prop">confirmEdits</a>, <a href="#confirmUpdate-prop">confirmUpdate</a>, and <a href="#confirmDelete-prop">confirmDelete</a>.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setConfirmInsert">setConfirmInsert</a>() and get this property's value with <a href="#confirmInsert">confirmInsert</a>().
|
||
|
<h3 class=fn>bool <a name="confirmUpdate-prop"></a>confirmUpdate</h3>
|
||
|
<p>This property holds whether the data table confirms update operations.
|
||
|
<p>If the confirmUpdate property is TRUE, all updates must be
|
||
|
confirmed by the user through a message box (this behaviour can be
|
||
|
changed by overriding the <a href="#confirmEdit">confirmEdit</a>() function), otherwise all
|
||
|
update operations occur immediately.
|
||
|
<p> <p>See also <a href="#confirmCancels-prop">confirmCancels</a>, <a href="#confirmEdits-prop">confirmEdits</a>, <a href="#confirmInsert-prop">confirmInsert</a>, and <a href="#confirmDelete-prop">confirmDelete</a>.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setConfirmUpdate">setConfirmUpdate</a>() and get this property's value with <a href="#confirmUpdate">confirmUpdate</a>().
|
||
13 years ago
|
<h3 class=fn><a href="ntqt.html#DateFormat-enum">DateFormat</a> <a name="dateFormat-prop"></a>dateFormat</h3>
|
||
13 years ago
|
<p>This property holds the format used for displaying date/time values.
|
||
|
<p>The dateFormat property is used for displaying date/time values in
|
||
13 years ago
|
the table. The default value is <a href="ntqt.html#DateFormat-enum">TQt::LocalDate</a>.
|
||
13 years ago
|
|
||
|
<p>Set this property's value with <a href="#setDateFormat">setDateFormat</a>() and get this property's value with <a href="#dateFormat">dateFormat</a>().
|
||
13 years ago
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="falseText-prop"></a>falseText</h3>
|
||
13 years ago
|
<p>This property holds the text used to represent false values.
|
||
|
<p>The falseText property will be used to represent NULL values in
|
||
|
the table. The default value is "False".
|
||
|
|
||
|
<p>Set this property's value with <a href="#setFalseText">setFalseText</a>() and get this property's value with <a href="#falseText">falseText</a>().
|
||
13 years ago
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="filter-prop"></a>filter</h3>
|
||
13 years ago
|
<p>This property holds the data filter for the data table.
|
||
|
<p>The filter applies to the data shown in the table. To view data
|
||
|
with a new filter, use <a href="#refresh">refresh</a>(). A filter string is an SQL WHERE
|
||
|
clause without the WHERE keyword.
|
||
|
<p> There is no default filter.
|
||
|
<p> <p>See also <a href="#sort-prop">sort</a>.
|
||
|
|
||
|
<p>
|
||
|
<p>Set this property's value with <a href="#setFilter">setFilter</a>() and get this property's value with <a href="#filter">filter</a>().
|
||
13 years ago
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="nullText-prop"></a>nullText</h3>
|
||
13 years ago
|
<p>This property holds the text used to represent NULL values.
|
||
|
<p>The nullText property will be used to represent NULL values in the
|
||
|
table. The default value is provided by the cursor's driver.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setNullText">setNullText</a>() and get this property's value with <a href="#nullText">nullText</a>().
|
||
|
<h3 class=fn>int <a name="numCols-prop"></a>numCols</h3>
|
||
|
<p>This property holds the number of columns in the table.
|
||
|
<p>
|
||
|
<p>Get this property's value with <a href="#numCols">numCols</a>().
|
||
|
<h3 class=fn>int <a name="numRows-prop"></a>numRows</h3>
|
||
|
<p>This property holds the number of rows in the table.
|
||
|
<p>
|
||
|
<p>Get this property's value with <a href="#numRows">numRows</a>().
|
||
13 years ago
|
<h3 class=fn><a href="ntqstringlist.html">TQStringList</a> <a name="sort-prop"></a>sort</h3>
|
||
13 years ago
|
<p>This property holds the data table's sort.
|
||
|
<p>The table's sort affects the order in which data records are
|
||
|
displayed in the table. To apply a sort, use <a href="#refresh">refresh</a>().
|
||
|
<p> When examining the sort property, a string list is returned with
|
||
|
each item having the form 'fieldname order' (e.g., 'id ASC',
|
||
|
'surname DESC').
|
||
|
<p> There is no default sort.
|
||
|
<p> Note that if you want to iterate over the sort list, you should
|
||
|
iterate over a copy, e.g.
|
||
|
<pre>
|
||
13 years ago
|
<a href="ntqstringlist.html">TQStringList</a> list = myDataTable.sort();
|
||
|
TQStringList::Iterator it = list.<a href="ntqvaluelist.html#begin">begin</a>();
|
||
|
while( it != list.<a href="ntqvaluelist.html#end">end</a>() ) {
|
||
13 years ago
|
myProcessing( *it );
|
||
|
++it;
|
||
|
}
|
||
|
</pre>
|
||
|
|
||
|
<p> <p>See also <a href="#filter-prop">filter</a> and <a href="#refresh">refresh</a>().
|
||
|
|
||
|
<p>Set this property's value with <a href="#setSort">setSort</a>() and get this property's value with <a href="#sort">sort</a>().
|
||
13 years ago
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="trueText-prop"></a>trueText</h3>
|
||
13 years ago
|
<p>This property holds the text used to represent true values.
|
||
|
<p>The trueText property will be used to represent NULL values in the
|
||
|
table. The default value is "True".
|
||
|
|
||
|
<p>Set this property's value with <a href="#setTrueText">setTrueText</a>() and get this property's value with <a href="#trueText">trueText</a>().
|
||
|
<!-- eof -->
|
||
|
<hr><p>
|
||
|
This file is part of the <a href="index.html">TQt toolkit</a>.
|
||
|
Copyright © 1995-2007
|
||
|
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
||
|
<table width=100% cellspacing=0 border=0><tr>
|
||
|
<td>Copyright © 2007
|
||
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
||
|
<td align=right><div align=right>TQt 3.3.8</div>
|
||
|
</table></div></address></body>
|
||
|
</html>
|