Sophie

Sophie

distrib > Mandriva > current > i586 > media > main-updates > by-pkgid > 8e6051afcdb111a0317a58fb64c2abf5 > files > 3505

qt4-doc-4.6.3-0.2mdv2010.2.i586.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- q3sqlpropertymap.cpp -->
<head>
  <title>Qt 4.6: Q3SqlPropertyMap Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<a name="//apple_ref/cpp/cl//Q3SqlPropertyMap"></a>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">All&nbsp;Functions</font></a>&nbsp;&middot; <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">Q3SqlPropertyMap Class Reference<br /><span class="small-subtitle">[<a href="qt3support.html">Qt3Support</a> module]</span>
</h1>
<p>The Q3SqlPropertyMap class is used to map widgets to SQL fields. <a href="#details">More...</a></p>
<pre> #include &lt;Q3SqlPropertyMap&gt;</pre><p><b>This class is part of the Qt 3 support library.</b> It is provided to keep old source code working. We strongly advise against using it in new code. See <a href="porting4.html#qsqlpropertymap">Porting to Qt 4</a> for more information.</p>
<p><b>This class is not part of the Qt GUI Framework Edition.</b></p>
<ul>
<li><a href="q3sqlpropertymap-members.html">List of all members, including inherited members</a></li>
</ul>
<hr />
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="q3sqlpropertymap.html#Q3SqlPropertyMap">Q3SqlPropertyMap</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><b><a href="q3sqlpropertymap.html#dtor.Q3SqlPropertyMap">~Q3SqlPropertyMap</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="q3sqlpropertymap.html#insert">insert</a></b> ( const QString &amp; <i>classname</i>, const QString &amp; <i>property</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QVariant </td><td class="memItemRight" valign="bottom"><b><a href="q3sqlpropertymap.html#property">property</a></b> ( QWidget * <i>widget</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="q3sqlpropertymap.html#remove">remove</a></b> ( const QString &amp; <i>classname</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="q3sqlpropertymap.html#setProperty">setProperty</a></b> ( QWidget * <i>widget</i>, const QVariant &amp; <i>value</i> )</td></tr>
</table>
<hr />
<a name="static-public-members"></a>
<h2>Static Public Members</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">Q3SqlPropertyMap * </td><td class="memItemRight" valign="bottom"><b><a href="q3sqlpropertymap.html#defaultMap">defaultMap</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="q3sqlpropertymap.html#installDefaultMap">installDefaultMap</a></b> ( Q3SqlPropertyMap * <i>map</i> )</td></tr>
</table>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The Q3SqlPropertyMap class is used to map widgets to SQL fields.</p>
<p>The SQL module uses Qt <a href="properties.html">object properties</a> to insert and extract values from editor widgets.</p>
<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>
<p>For example, a <a href="qlineedit.html">QLineEdit</a> can be used to edit text strings and other data types in Q3DataTables or Q3SqlForms. Several properties are defined in <a href="qlineedit.html">QLineEdit</a>, but only the <i>text</i> property is used to insert and extract text from a <a href="qlineedit.html">QLineEdit</a>. Both <a href="q3datatable.html">Q3DataTable</a> and <a href="q3sqlform.html">Q3SqlForm</a> use the global Q3SqlPropertyMap 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>
<p>If you want to use custom editors with your <a href="q3datatable.html">Q3DataTable</a> or <a href="q3sqlform.html">Q3SqlForm</a>, you must install your own Q3SqlPropertyMap for that table or form. Example:</p>
<pre> Q3SqlPropertyMap *myMap  = new Q3SqlPropertyMap();
 Q3SqlForm        *myForm = new Q3SqlForm(this);
 MyEditor myEditor(this);

<span class="comment"> // Set the Q3SqlForm's record buffer to the update buffer of</span>
<span class="comment"> // a pre-existing Q3SqlCursor called 'cur'.</span>
 myForm-&gt;setRecord(cur-&gt;primeUpdate());

<span class="comment"> // Install the customized map</span>
 myMap-&gt;insert(&quot;MyEditor&quot;, &quot;content&quot;);
 myForm-&gt;installPropertyMap(myMap); <span class="comment">// myForm now owns myMap</span>
 ...
<span class="comment"> // Insert a field into the form that uses a myEditor to edit the</span>
<span class="comment"> // field 'somefield'</span>
 myForm-&gt;insert(&amp;myEditor, &quot;somefield&quot;);

<span class="comment"> // Update myEditor with the value from the mapped database field</span>
 myForm-&gt;readFields();
 ...
<span class="comment"> // Let the user edit the form</span>
 ...
<span class="comment"> // Update the database fields with the values in the form</span>
 myForm-&gt;writeFields();
 ...</pre>
<p>You can also replace the global Q3SqlPropertyMap that is used by default. (Bear in mind that Q3SqlPropertyMap takes ownership of the new default map.)</p>
<pre> Q3SqlPropertyMap *myMap = new Q3SqlPropertyMap;

 myMap-&gt;insert(&quot;MyEditor&quot;, &quot;content&quot;);
 Q3SqlPropertyMap::installDefaultMap(myMap);
 ...</pre>
<p>See also <a href="q3datatable.html">Q3DataTable</a>, <a href="q3sqlform.html">Q3SqlForm</a>, and <a href="q3sqleditorfactory.html">Q3SqlEditorFactory</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<a name="//apple_ref/cpp/instm/Q3SqlPropertyMap/Q3SqlPropertyMap"></a>
<h3 class="fn"><a name="Q3SqlPropertyMap"></a>Q3SqlPropertyMap::Q3SqlPropertyMap ()</h3>
<p>Constructs a <a href="q3sqlpropertymap.html" class="compat">Q3SqlPropertyMap</a>.</p>
<p>The default property mappings used by Qt widgets are:</p>
<p><table class="generic" align="center" cellpadding="2" cellspacing="1" border="0">
<thead><tr valign="top" class="qt-style"><th>Widgets</th><th>Property</th></tr></thead>
<tr valign="top" class="odd"><td><a href="qcheckbox.html">QCheckBox</a>, <a href="qradiobutton.html">QRadioButton</a></td><td>checked</td></tr>
<tr valign="top" class="even"><td><a href="qcombobox.html">QComboBox</a>, <a href="q3listbox.html" class="compat">Q3ListBox</a></td><td>currentItem</td></tr>
<tr valign="top" class="odd"><td><a href="q3dateedit.html" class="compat">Q3DateEdit</a></td><td>date</td></tr>
<tr valign="top" class="even"><td><a href="q3datetimeedit.html" class="compat">Q3DateTimeEdit</a> <a href="qdatetimeedit.html">QDateTimeEdit</a></td><td>dateTime</td></tr>
<tr valign="top" class="odd"><td><a href="qtextbrowser.html">QTextBrowser</a></td><td>source</td></tr>
<tr valign="top" class="even"><td><a href="qabstractbutton.html">QAbstractButton</a>, <a href="qdial.html">QDial</a>, <a href="qlabel.html">QLabel</a>, <a href="qlineedit.html">QLineEdit</a>, <a href="q3multilineedit.html" class="compat">Q3MultiLineEdit</a>, <a href="qpushbutton.html">QPushButton</a>, <a href="qtextedit.html">QTextEdit</a>,</td><td>text</td></tr>
<tr valign="top" class="odd"><td><a href="q3timeedit.html" class="compat">Q3TimeEdit</a></td><td>time</td></tr>
<tr valign="top" class="even"><td><a href="qlcdnumber.html">QLCDNumber</a>, <a href="qscrollbar.html">QScrollBar</a> <a href="qslider.html">QSlider</a>, <a href="qspinbox.html">QSpinBox</a></td><td>value</td></tr>
</table></p>
<a name="//apple_ref/cpp/instm/Q3SqlPropertyMap/~Q3SqlPropertyMap"></a>
<h3 class="fn"><a name="dtor.Q3SqlPropertyMap"></a>Q3SqlPropertyMap::~Q3SqlPropertyMap ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Destroys the <a href="q3sqlpropertymap.html" class="compat">Q3SqlPropertyMap</a>.</p>
<p>Note that if the <a href="q3sqlpropertymap.html" class="compat">Q3SqlPropertyMap</a> is installed with installPropertyMap() the object it was installed into, e.g&#x2e; the <a href="q3sqlform.html" class="compat">Q3SqlForm</a>, takes ownership and will delete the <a href="q3sqlpropertymap.html" class="compat">Q3SqlPropertyMap</a> when necessary.</p>
<a name="//apple_ref/cpp/clm/Q3SqlPropertyMap/defaultMap"></a>
<h3 class="fn"><a name="defaultMap"></a>Q3SqlPropertyMap * Q3SqlPropertyMap::defaultMap ()&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns the application global <a href="q3sqlpropertymap.html" class="compat">Q3SqlPropertyMap</a>.</p>
<a name="//apple_ref/cpp/instm/Q3SqlPropertyMap/insert"></a>
<h3 class="fn"><a name="insert"></a>void Q3SqlPropertyMap::insert ( const <a href="qstring.html">QString</a> &amp; <i>classname</i>, const <a href="qstring.html">QString</a> &amp; <i>property</i> )</h3>
<p>Insert a new classname/property pair, which is used for custom SQL field editors. There <i>must</i> be a <a href="qobject.html#Q_PROPERTY">Q_PROPERTY</a>() clause in the <i>classname</i> class declaration for the <i>property</i>.</p>
<a name="//apple_ref/cpp/clm/Q3SqlPropertyMap/installDefaultMap"></a>
<h3 class="fn"><a name="installDefaultMap"></a>void Q3SqlPropertyMap::installDefaultMap ( Q3SqlPropertyMap * <i>map</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Replaces the global default property map with <i>map</i>. All <a href="q3datatable.html" class="compat">Q3DataTable</a> and <a href="q3sqlform.html" class="compat">Q3SqlForm</a> instantiations will use this new map for inserting and extracting values to and from editors. <i><a href="q3sqlpropertymap.html" class="compat">Q3SqlPropertyMap</a> takes ownership of <i>map</i>, and destroys it when it is no longer needed.</i></p>
<a name="//apple_ref/cpp/instm/Q3SqlPropertyMap/property"></a>
<h3 class="fn"><a name="property"></a><a href="qvariant.html">QVariant</a> Q3SqlPropertyMap::property ( <a href="qwidget.html">QWidget</a> * <i>widget</i> )</h3>
<p>Returns the mapped property of <i>widget</i> as a <a href="qvariant.html">QVariant</a>.</p>
<p>See also <a href="q3sqlpropertymap.html#setProperty">setProperty</a>().</p>
<a name="//apple_ref/cpp/instm/Q3SqlPropertyMap/remove"></a>
<h3 class="fn"><a name="remove"></a>void Q3SqlPropertyMap::remove ( const <a href="qstring.html">QString</a> &amp; <i>classname</i> )</h3>
<p>Removes <i>classname</i> from the map.</p>
<a name="//apple_ref/cpp/instm/Q3SqlPropertyMap/setProperty"></a>
<h3 class="fn"><a name="setProperty"></a>void Q3SqlPropertyMap::setProperty ( <a href="qwidget.html">QWidget</a> * <i>widget</i>, const <a href="qvariant.html">QVariant</a> &amp; <i>value</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Sets the property of <i>widget</i> to <i>value</i>.</p>
<p>See also <a href="q3sqlpropertymap.html#property">property</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="40%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
<td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="40%" align="right"><div align="right">Qt 4.6.3</div></td>
</tr></table></div></address></body>
</html>