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.
See also
PySide.QtSql.QSqlRelationalTableModel Model/View Programming
Parameters: | aParent – PySide.QtCore.QObject |
---|
Constructs a PySide.QtSql.QSqlRelationalDelegate object with the given parent .