File: qsqlrelationaldelegate.html

package info (click to toggle)
python-qt4 4.0.1-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 18,632 kB
  • ctags: 2,639
  • sloc: python: 29,409; sh: 5,646; cpp: 3,168; xml: 149; makefile: 109
file content (21 lines) | stat: -rw-r--r-- 5,081 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QSqlRelationalDelegate Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QSqlRelationalDelegate Class Reference<br /><sup><sup>[<a href="qtsql.html">QtSql</a> module]</sup></sup></h1><p>The QSqlRelationalDelegate class provides a delegate that is used to display and edit data from a <a href="qsqlrelationaltablemodel.html">QSqlRelationalTableModel</a>. <a href="#details">More...</a></p>
<p>Inherits <a href="qitemdelegate.html">QItemDelegate</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qsqlrelationaldelegate.html#QSqlRelationalDelegate">__init__</a></b> (<i>self</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />QWidget <b><a href="qsqlrelationaldelegate.html#createEditor">createEditor</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>, QStyleOptionViewItem&#160;<i>option</i>, QModelIndex&#160;<i>index</i>)</li><li><div class="fn" /><b><a href="qsqlrelationaldelegate.html#setEditorData">setEditorData</a></b> (<i>self</i>, QWidget&#160;<i>editor</i>, QModelIndex&#160;<i>index</i>)</li><li><div class="fn" /><b><a href="qsqlrelationaldelegate.html#setModelData">setModelData</a></b> (<i>self</i>, QWidget&#160;<i>editor</i>, QAbstractItemModel&#160;<i>model</i>, QModelIndex&#160;<i>index</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QSqlRelationalDelegate class provides a delegate that is used to display and edit data from a <a href="qsqlrelationaltablemodel.html">QSqlRelationalTableModel</a>.</p>
<p>Unlike the default delegate, QSqlRelationalDelegate provides a combobox for fields that are foreign keys into other tables. To use the class, simply call <a href="qabstractitemview.html#setItemDelegate">QAbstractItemView.setItemDelegate</a>() on the view with an instance of QSqlRelationalDelegate:</p>
<pre>
        QTableView *view = new QTableView;
        view-&gt;setModel(model);
        view-&gt;setItemDelegate(new QSqlRelationalDelegate(view));
</pre>
<p>The <a href="sql-relationaltablemodel.html">Relational Table Model</a> example (shown below) illustrates how to use QSqlRelationalDelegate in conjunction with <a href="qsqlrelationaltablemodel.html">QSqlRelationalTableModel</a> to provide tables with foreign key support.</p>
<p align="center"><img src="images/relationaltable.png" /></p>
<p>See also <a href="qsqlrelationaltablemodel.html">QSqlRelationalTableModel</a> and <a href="model-view-programming.html">Model/View Programming</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QSqlRelationalDelegate" />QSqlRelationalDelegate.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a <a href="qsqlrelationaldelegate.html">QSqlRelationalDelegate</a> object with the given <i>parent</i>.</p>
<h3 class="fn"><a name="createEditor" /><a href="qwidget.html">QWidget</a> QSqlRelationalDelegate.createEditor (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a>&#160;<i>option</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>)</h3><h3 class="fn"><a name="setEditorData" />QSqlRelationalDelegate.setEditorData (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>editor</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>)</h3><h3 class="fn"><a name="setModelData" />QSqlRelationalDelegate.setModelData (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>editor</i>, <a href="qabstractitemmodel.html">QAbstractItemModel</a>&#160;<i>model</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt&#160;4.0.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.trolltech.com">Trolltech&#160;AS</a> 2006</td><td align="right" width="25%">Qt&#160;4.1.4</td></tr></table></div></address></body></html>