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.
200 lines
9.8 KiB
200 lines
9.8 KiB
<!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/tqsqlpropertymap.cpp:53 -->
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>TQSqlPropertyMap 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>TQSqlPropertyMap Class Reference<br><small>[<a href="sql.html">sql module</a>]</small></h1>
|
|
|
|
<p>The TQSqlPropertyMap class is used to map widgets to SQL fields.
|
|
<a href="#details">More...</a>
|
|
<p><tt>#include <<a href="tqsqlpropertymap-h.html">tqsqlpropertymap.h</a>></tt>
|
|
<p><a href="tqsqlpropertymap-members.html">List of all member functions.</a>
|
|
<h2>Public Members</h2>
|
|
<ul>
|
|
<li class=fn><a href="#TQSqlPropertyMap"><b>TQSqlPropertyMap</b></a> ()</li>
|
|
<li class=fn>virtual <a href="#~TQSqlPropertyMap"><b>~TQSqlPropertyMap</b></a> ()</li>
|
|
<li class=fn>TQVariant <a href="#property"><b>property</b></a> ( TQWidget * widget )</li>
|
|
<li class=fn>virtual void <a href="#setProperty"><b>setProperty</b></a> ( TQWidget * widget, const TQVariant & value )</li>
|
|
<li class=fn>void <a href="#insert"><b>insert</b></a> ( const TQString & classname, const TQString & property )</li>
|
|
<li class=fn>void <a href="#remove"><b>remove</b></a> ( const TQString & classname )</li>
|
|
</ul>
|
|
<h2>Static Public Members</h2>
|
|
<ul>
|
|
<li class=fn>TQSqlPropertyMap * <a href="#defaultMap"><b>defaultMap</b></a> ()</li>
|
|
<li class=fn>void <a href="#installDefaultMap"><b>installDefaultMap</b></a> ( TQSqlPropertyMap * map )</li>
|
|
</ul>
|
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
|
|
|
|
|
The TQSqlPropertyMap class is used to map widgets to SQL fields.
|
|
<p>
|
|
|
|
<p> The SQL module uses TQt <a href="properties.html">object
|
|
properties</a> to insert and extract values from editor
|
|
widgets.
|
|
<p> This class is used to map editors to SQL fields. This works by
|
|
associating SQL editor class names to the properties used to
|
|
insert and extract values to/from the editor.
|
|
<p> For example, a <a href="tqlineedit.html">TQLineEdit</a> can be used to edit text strings and
|
|
other data types in TQDataTables or TQSqlForms. Several properties
|
|
are defined in TQLineEdit, but only the <em>text</em> property is used to
|
|
insert and extract text from a TQLineEdit. Both <a href="tqdatatable.html">TQDataTable</a> and
|
|
<a href="tqsqlform.html">TQSqlForm</a> use the global TQSqlPropertyMap for inserting and
|
|
extracting values to and from an editor widget. The global
|
|
property map defines several common widgets and properties that
|
|
are suitable for many applications. You can add and remove widget
|
|
properties to suit your specific needs.
|
|
<p> If you want to use custom editors with your TQDataTable or
|
|
TQSqlForm, you must install your own TQSqlPropertyMap for that table
|
|
or form. Example:
|
|
<p> <pre>
|
|
TQSqlPropertyMap *myMap = new TQSqlPropertyMap();
|
|
<a href="tqsqlform.html">TQSqlForm</a> *myForm = new <a href="tqsqlform.html">TQSqlForm</a>( this );
|
|
MyEditor myEditor( this );
|
|
|
|
// Set the TQSqlForm's record buffer to the update buffer of
|
|
// a pre-existing TQSqlCursor called 'cur'.
|
|
myForm-><a href="tqsqlform.html#setRecord">setRecord</a>( cur->primeUpdate() );
|
|
|
|
// Install the customized map
|
|
myMap-><a href="#insert">insert</a>( "MyEditor", "content" );
|
|
myForm-><a href="tqsqlform.html#installPropertyMap">installPropertyMap</a>( myMap ); // myForm now owns myMap
|
|
...
|
|
// Insert a field into the form that uses a myEditor to edit the
|
|
// field 'somefield'
|
|
myForm-><a href="tqsqlform.html#insert">insert</a>( &myEditor, "somefield" );
|
|
|
|
// Update myEditor with the value from the mapped database field
|
|
myForm-><a href="tqsqlform.html#readFields">readFields</a>();
|
|
...
|
|
// Let the user edit the form
|
|
...
|
|
// Update the database fields with the values in the form
|
|
myForm-><a href="tqsqlform.html#writeFields">writeFields</a>();
|
|
...
|
|
</pre>
|
|
|
|
<p> You can also replace the global TQSqlPropertyMap that is used by
|
|
default. (Bear in mind that TQSqlPropertyMap takes ownership of the
|
|
new default map.)
|
|
<p> <pre>
|
|
TQSqlPropertyMap *myMap = new TQSqlPropertyMap;
|
|
|
|
myMap-><a href="#insert">insert</a>( "MyEditor", "content" );
|
|
TQSqlPropertyMap::<a href="#installDefaultMap">installDefaultMap</a>( myMap );
|
|
...
|
|
</pre>
|
|
|
|
<p> <p>See also <a href="tqdatatable.html">TQDataTable</a>, <a href="tqsqlform.html">TQSqlForm</a>, <a href="tqsqleditorfactory.html">TQSqlEditorFactory</a>, and <a href="database.html">Database Classes</a>.
|
|
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<h3 class=fn><a name="TQSqlPropertyMap"></a>TQSqlPropertyMap::TQSqlPropertyMap ()
|
|
</h3>
|
|
<p> Constructs a TQSqlPropertyMap.
|
|
<p> The default property mappings used by TQt widgets are:
|
|
<center><table cellpadding="4" cellspacing="2" border="0">
|
|
<tr bgcolor="#a2c511"> <th valign="top">Widgets <th valign="top">Property
|
|
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="tqcheckbox.html">TQCheckBox</a>,
|
|
<a href="tqradiobutton.html">TQRadioButton</a>
|
|
<td valign="top">checked
|
|
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="tqcombobox.html">TQComboBox</a>,
|
|
<a href="tqlistbox.html">TQListBox</a>
|
|
<td valign="top">currentItem
|
|
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="tqdateedit.html">TQDateEdit</a>
|
|
<td valign="top">date
|
|
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="tqdatetimeedit.html">TQDateTimeEdit</a>
|
|
<td valign="top">dateTime
|
|
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="tqtextbrowser.html">TQTextBrowser</a>
|
|
<td valign="top">source
|
|
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="tqbutton.html">TQButton</a>,
|
|
<a href="tqdial.html">TQDial</a>,
|
|
<a href="tqlabel.html">TQLabel</a>,
|
|
<a href="tqlineedit.html">TQLineEdit</a>,
|
|
<a href="tqmultilineedit.html">TQMultiLineEdit</a>,
|
|
<a href="tqpushbutton.html">TQPushButton</a>,
|
|
<a href="tqtextedit.html">TQTextEdit</a>,
|
|
<td valign="top">text
|
|
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="tqtimeedit.html">TQTimeEdit</a>
|
|
<td valign="top">time
|
|
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="tqlcdnumber.html">TQLCDNumber</a>,
|
|
<a href="tqscrollbar.html">TQScrollBar</a>
|
|
<a href="tqslider.html">TQSlider</a>,
|
|
<a href="tqspinbox.html">TQSpinBox</a>
|
|
<td valign="top">value
|
|
</table></center>
|
|
|
|
<h3 class=fn><a name="~TQSqlPropertyMap"></a>TQSqlPropertyMap::~TQSqlPropertyMap ()<tt> [virtual]</tt>
|
|
</h3>
|
|
Destroys the TQSqlPropertyMap.
|
|
<p> Note that if the TQSqlPropertyMap is installed with
|
|
installPropertyMap() the object it was installed into, e.g. the
|
|
<a href="tqsqlform.html">TQSqlForm</a>, takes ownership and will delete the TQSqlPropertyMap when
|
|
necessary.
|
|
|
|
<h3 class=fn><a href="tqsqlpropertymap.html">TQSqlPropertyMap</a> * <a name="defaultMap"></a>TQSqlPropertyMap::defaultMap ()<tt> [static]</tt>
|
|
</h3>
|
|
Returns the application global TQSqlPropertyMap.
|
|
|
|
<h3 class=fn>void <a name="insert"></a>TQSqlPropertyMap::insert ( const <a href="tqstring.html">TQString</a> & classname, const <a href="tqstring.html">TQString</a> & property )
|
|
</h3>
|
|
Insert a new classname/property pair, which is used for custom SQL
|
|
field editors. There <em>must</em> be a <tt>TQ_PROPERTY</tt> clause in the <em>classname</em> class declaration for the <em>property</em>.
|
|
|
|
<p>Example: <a href="sql.html#x2239">sql/overview/custom1/main.cpp</a>.
|
|
<h3 class=fn>void <a name="installDefaultMap"></a>TQSqlPropertyMap::installDefaultMap ( <a href="tqsqlpropertymap.html">TQSqlPropertyMap</a> * map )<tt> [static]</tt>
|
|
</h3>
|
|
Replaces the global default property map with <em>map</em>. All
|
|
<a href="tqdatatable.html">TQDataTable</a> and <a href="tqsqlform.html">TQSqlForm</a> instantiations will use this new map for
|
|
inserting and extracting values to and from editors.
|
|
<em>TQSqlPropertyMap takes ownership of \a map, and destroys it when it is no longer needed.</em>
|
|
|
|
<h3 class=fn><a href="ntqvariant.html">TQVariant</a> <a name="property"></a>TQSqlPropertyMap::property ( <a href="tqwidget.html">TQWidget</a> * widget )
|
|
</h3>
|
|
Returns the mapped property of <em>widget</em> as a <a href="ntqvariant.html">TQVariant</a>.
|
|
|
|
<h3 class=fn>void <a name="remove"></a>TQSqlPropertyMap::remove ( const <a href="tqstring.html">TQString</a> & classname )
|
|
</h3>
|
|
Removes <em>classname</em> from the map.
|
|
|
|
<h3 class=fn>void <a name="setProperty"></a>TQSqlPropertyMap::setProperty ( <a href="tqwidget.html">TQWidget</a> * widget, const <a href="ntqvariant.html">TQVariant</a> & value )<tt> [virtual]</tt>
|
|
</h3>
|
|
Sets the property of <em>widget</em> to <em>value</em>.
|
|
|
|
<!-- 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>
|