Table Of Contents

Previous topic

QSqlRelationalTableModel

Next topic

PySide.QtSvg

QSqlRelationalDelegate

Detailed Description

The PySide.QtSql.QSqlRelationalDelegate class provides a delegate that is used to display and edit data from a PySide.QtSql.QSqlRelationalTableModel .

Unlike the default delegate, PySide.QtSql.QSqlRelationalDelegate provides a combobox for fields that are foreign keys into other tables. To use the class, simply call QAbstractItemView.setItemDelegate() on the view with an instance of PySide.QtSql.QSqlRelationalDelegate :

view =  QTableView()
view.setModel(model)
view.setItemDelegate(QSqlRelationalDelegate(view))

The Relational Table Model example (shown below) illustrates how to use PySide.QtSql.QSqlRelationalDelegate in conjunction with PySide.QtSql.QSqlRelationalTableModel to provide tables with foreign key support.

../../_images/relationaltable.png

See also

PySide.QtSql.QSqlRelationalTableModel Model/View Programming

class PySide.QtSql.QSqlRelationalDelegate([aParent=None])
Parameters:aParentPySide.QtCore.QObject

Constructs a PySide.QtSql.QSqlRelationalDelegate object with the given parent .