diff options
author | Timothy Pearson <[email protected]> | 2012-01-26 23:32:43 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-01-26 23:32:43 -0600 |
commit | ea318d1431c89e647598c510c4245c6571aa5f46 (patch) | |
tree | 996d29b80c30d453dda86d1a23162d441628f169 /doc/html/ntqsqlform.html | |
parent | aaf89d4b48f69c9293feb187db26362e550b5561 (diff) | |
download | tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.tar.gz tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.zip |
Update to latest tqt3 automated conversion
Diffstat (limited to 'doc/html/ntqsqlform.html')
-rw-r--r-- | doc/html/ntqsqlform.html | 237 |
1 files changed, 237 insertions, 0 deletions
diff --git a/doc/html/ntqsqlform.html b/doc/html/ntqsqlform.html new file mode 100644 index 000000000..79090960f --- /dev/null +++ b/doc/html/ntqsqlform.html @@ -0,0 +1,237 @@ +<!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/qsqlform.cpp:61 --> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>TQSqlForm 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>TQSqlForm Class Reference<br><small>[<a href="sql.html">sql module</a>]</small></h1> + +<p>The TQSqlForm class creates and manages data entry forms +tied to SQL databases. +<a href="#details">More...</a> +<p><tt>#include <<a href="qsqlform-h.html">ntqsqlform.h</a>></tt> +<p>Inherits <a href="ntqobject.html">TQObject</a>. +<p><a href="qsqlform-members.html">List of all member functions.</a> +<h2>Public Members</h2> +<ul> +<li class=fn><a href="#TQSqlForm"><b>TQSqlForm</b></a> ( TQObject * parent = 0, const char * name = 0 )</li> +<li class=fn><a href="#~TQSqlForm"><b>~TQSqlForm</b></a> ()</li> +<li class=fn>virtual void <a href="#insert"><b>insert</b></a> ( TQWidget * widget, const TQString & field )</li> +<li class=fn>virtual void <a href="#remove-2"><b>remove</b></a> ( const TQString & field )</li> +<li class=fn>uint <a href="#count"><b>count</b></a> () const</li> +<li class=fn>TQWidget * <a href="#widget"><b>widget</b></a> ( uint i ) const</li> +<li class=fn>TQSqlField * <a href="#widgetToField"><b>widgetToField</b></a> ( TQWidget * widget ) const</li> +<li class=fn>TQWidget * <a href="#fieldToWidget"><b>fieldToWidget</b></a> ( TQSqlField * field ) const</li> +<li class=fn>void <a href="#installPropertyMap"><b>installPropertyMap</b></a> ( TQSqlPropertyMap * pmap )</li> +<li class=fn>virtual void <a href="#setRecord"><b>setRecord</b></a> ( TQSqlRecord * buf )</li> +</ul> +<h2>Public Slots</h2> +<ul> +<li class=fn>virtual void <a href="#readField"><b>readField</b></a> ( TQWidget * widget )</li> +<li class=fn>virtual void <a href="#writeField"><b>writeField</b></a> ( TQWidget * widget )</li> +<li class=fn>virtual void <a href="#readFields"><b>readFields</b></a> ()</li> +<li class=fn>virtual void <a href="#writeFields"><b>writeFields</b></a> ()</li> +<li class=fn>virtual void <a href="#clear"><b>clear</b></a> ()</li> +<li class=fn>virtual void <a href="#clearValues"><b>clearValues</b></a> ( bool nullify = FALSE )</li> +</ul> +<h2>Protected Members</h2> +<ul> +<li class=fn>virtual void <a href="#insert-2"><b>insert</b></a> ( TQWidget * widget, TQSqlField * field )</li> +<li class=fn>virtual void <a href="#remove"><b>remove</b></a> ( TQWidget * widget )</li> +</ul> +<hr><a name="details"></a><h2>Detailed Description</h2> + + +The TQSqlForm class creates and manages data entry forms +tied to SQL databases. +<p> + + +<p> Typical use of a TQSqlForm consists of the following steps: +<ul> +<li> Create the widgets you want to appear in the form. +<li> Create a cursor and navigate to the record to be edited. +<li> Create the TQSqlForm. +<li> Set the form's record buffer to the cursor's update buffer. +<li> Insert each widget and the field it is to edit into the form. +<li> Use <a href="#readFields">readFields</a>() to update the editor widgets with values from +the database's fields. +<li> Display the form and let the user edit values etc. +<li> Use <a href="#writeFields">writeFields</a>() to update the database's field values with +the values in the editor widgets. +</ul> +<p> Note that a TQSqlForm does not access the database directly, but +most often via TQSqlFields which are part of a <a href="ntqsqlcursor.html">TQSqlCursor</a>. A +<a href="ntqsqlcursor.html#insert">TQSqlCursor::insert</a>(), <a href="ntqsqlcursor.html#update">TQSqlCursor::update</a>() or <a href="ntqsqlcursor.html#del">TQSqlCursor::del</a>() +call is needed to actually write values to the database. +<p> Some sample code to initialize a form successfully: +<p> <pre> + <a href="ntqlineedit.html">TQLineEdit</a> myEditor( this ); + TQSqlForm myForm( this ); + <a href="ntqsqlcursor.html">TQSqlCursor</a> myCursor( "mytable" ); + + // Execute a query to make the cursor valid + myCursor.<a href="ntqsqlcursor.html#select">select</a>(); + // Move the cursor to a valid record (the first record) + myCursor.<a href="ntqsqlquery.html#next">next</a>(); + // Set the form's record pointer to the cursor's edit buffer (which + // contains the current record's values) + myForm.<a href="#setRecord">setRecord</a>( myCursor.<a href="ntqsqlcursor.html#primeUpdate">primeUpdate</a>() ); + + // Insert a field into the form that uses myEditor to edit the + // field 'somefield' in 'mytable' + myForm.<a href="#insert">insert</a>( &myEditor, "somefield" ); + + // Update myEditor with the value from the mapped database field + myForm.<a href="#readFields">readFields</a>(); + ... + // Let the user edit the form + ... + // Update the database + myForm.<a href="#writeFields">writeFields</a>(); // Update the cursor's edit buffer from the form + myCursor.<a href="ntqsqlcursor.html#update">update</a>(); // Update the database from the cursor's buffer + </pre> + +<p> If you want to use custom editors for displaying and editing data +fields, you must install a custom <a href="ntqsqlpropertymap.html">TQSqlPropertyMap</a>. The form +uses this object to get or set the value of a widget. +<p> Note that <a href="designer-manual.html">TQt Designer</a> provides +a visual means of creating data-aware forms. +<p> <p>See also <a href="#installPropertyMap">installPropertyMap</a>(), <a href="ntqsqlpropertymap.html">TQSqlPropertyMap</a>, and <a href="database.html">Database Classes</a>. + +<hr><h2>Member Function Documentation</h2> +<h3 class=fn><a name="TQSqlForm"></a>TQSqlForm::TQSqlForm ( <a href="ntqobject.html">TQObject</a> * parent = 0, const char * name = 0 ) +</h3> +Constructs a TQSqlForm with parent <em>parent</em> and called <em>name</em>. + +<h3 class=fn><a name="~TQSqlForm"></a>TQSqlForm::~TQSqlForm () +</h3> +Destroys the object and frees any allocated resources. + +<h3 class=fn>void <a name="clear"></a>TQSqlForm::clear ()<tt> [virtual slot]</tt> +</h3> +Removes every widget, and the fields they're mapped to, from the form. + +<h3 class=fn>void <a name="clearValues"></a>TQSqlForm::clearValues ( bool nullify = FALSE )<tt> [virtual slot]</tt> +</h3> +Clears the values in all the widgets, and the fields they are +mapped to, in the form. If <em>nullify</em> is TRUE (the default is +FALSE), each field is also set to NULL. + +<h3 class=fn>uint <a name="count"></a>TQSqlForm::count () const +</h3> +Returns the number of widgets in the form. + +<h3 class=fn><a href="ntqwidget.html">TQWidget</a> * <a name="fieldToWidget"></a>TQSqlForm::fieldToWidget ( <a href="ntqsqlfield.html">TQSqlField</a> * field ) const +</h3> +Returns the widget that field <em>field</em> is mapped to. + +<h3 class=fn>void <a name="insert"></a>TQSqlForm::insert ( <a href="ntqwidget.html">TQWidget</a> * widget, const <a href="ntqstring.html">TQString</a> & field )<tt> [virtual]</tt> +</h3> +Inserts a <em>widget</em>, and the name of the <em>field</em> it is to be +mapped to, into the form. To actually associate inserted widgets +with an edit buffer, use <a href="#setRecord">setRecord</a>(). +<p> <p>See also <a href="#setRecord">setRecord</a>(). + +<p>Examples: <a href="sql.html#x2225">sql/overview/form1/main.cpp</a> and <a href="sql.html#x2231">sql/overview/form2/main.cpp</a>. +<h3 class=fn>void <a name="insert-2"></a>TQSqlForm::insert ( <a href="ntqwidget.html">TQWidget</a> * widget, <a href="ntqsqlfield.html">TQSqlField</a> * field )<tt> [virtual protected]</tt> +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Inserts a <em>widget</em>, and the <em>field</em> it is to be mapped to, into +the form. + +<h3 class=fn>void <a name="installPropertyMap"></a>TQSqlForm::installPropertyMap ( <a href="ntqsqlpropertymap.html">TQSqlPropertyMap</a> * pmap ) +</h3> +Installs a custom <a href="ntqsqlpropertymap.html">TQSqlPropertyMap</a>. This is useful if you plan to +create your own custom editor widgets. +<p> TQSqlForm takes ownership of <em>pmap</em>, so <em>pmap</em> is deleted when +TQSqlForm goes out of scope. +<p> <p>See also <a href="ntqdatatable.html#installEditorFactory">TQDataTable::installEditorFactory</a>(). + +<p>Example: <a href="sql.html#x2237">sql/overview/custom1/main.cpp</a>. +<h3 class=fn>void <a name="readField"></a>TQSqlForm::readField ( <a href="ntqwidget.html">TQWidget</a> * widget )<tt> [virtual slot]</tt> +</h3> +Updates the widget <em>widget</em> with the value from the SQL field it +is mapped to. Nothing happens if no SQL field is mapped to the <em>widget</em>. + +<h3 class=fn>void <a name="readFields"></a>TQSqlForm::readFields ()<tt> [virtual slot]</tt> +</h3> +Updates the widgets in the form with current values from the SQL +fields they are mapped to. + +<p>Examples: <a href="sql.html#x2226">sql/overview/form1/main.cpp</a> and <a href="sql.html#x2232">sql/overview/form2/main.cpp</a>. +<h3 class=fn>void <a name="remove"></a>TQSqlForm::remove ( <a href="ntqwidget.html">TQWidget</a> * widget )<tt> [virtual protected]</tt> +</h3> +Removes a <em>widget</em>, and hence the field it's mapped to, from the +form. + +<h3 class=fn>void <a name="remove-2"></a>TQSqlForm::remove ( const <a href="ntqstring.html">TQString</a> & field )<tt> [virtual]</tt> +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Removes <em>field</em> from the form. + +<h3 class=fn>void <a name="setRecord"></a>TQSqlForm::setRecord ( <a href="ntqsqlrecord.html">TQSqlRecord</a> * buf )<tt> [virtual]</tt> +</h3> +Sets <em>buf</em> as the record buffer for the form. To force the +display of the data from <em>buf</em>, use <a href="#readFields">readFields</a>(). +<p> <p>See also <a href="#readFields">readFields</a>() and <a href="#writeFields">writeFields</a>(). + +<p>Examples: <a href="sql.html#x2238">sql/overview/custom1/main.cpp</a>, <a href="sql.html#x2227">sql/overview/form1/main.cpp</a>, and <a href="sql.html#x2233">sql/overview/form2/main.cpp</a>. +<h3 class=fn><a href="ntqwidget.html">TQWidget</a> * <a name="widget"></a>TQSqlForm::widget ( uint i ) const +</h3> +Returns the <em>i</em>-th widget in the form. Useful for traversing +the widgets in the form. + +<h3 class=fn><a href="ntqsqlfield.html">TQSqlField</a> * <a name="widgetToField"></a>TQSqlForm::widgetToField ( <a href="ntqwidget.html">TQWidget</a> * widget ) const +</h3> +Returns the SQL field that widget <em>widget</em> is mapped to. + +<h3 class=fn>void <a name="writeField"></a>TQSqlForm::writeField ( <a href="ntqwidget.html">TQWidget</a> * widget )<tt> [virtual slot]</tt> +</h3> +Updates the SQL field with the value from the <em>widget</em> it is +mapped to. Nothing happens if no SQL field is mapped to the <em>widget</em>. + +<h3 class=fn>void <a name="writeFields"></a>TQSqlForm::writeFields ()<tt> [virtual slot]</tt> +</h3> +Updates the SQL fields with values from the widgets they are +mapped to. To actually update the database with the contents of +the record buffer, use <a href="ntqsqlcursor.html#insert">TQSqlCursor::insert</a>(), <a href="ntqsqlcursor.html#update">TQSqlCursor::update</a>() +or <a href="ntqsqlcursor.html#del">TQSqlCursor::del</a>() as appropriate. + +<p>Example: <a href="sql.html#x2234">sql/overview/form2/main.cpp</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> |