• PySide 模块
  • PySide.QtSql
  • 内容表表

    上一话题

    QSqlRelationalTableModel

    下一话题

    PySide.QtSvg

    QSqlRelationalDelegate

    详细描述

    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))
    										

    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

    另请参阅

    PySide.QtSql.QSqlRelationalTableModel 模型/视图编程

    class PySide.QtSql. QSqlRelationalDelegate ( [ aParent=None ] )
    参数: aParent PySide.QtCore.QObject

    构造 PySide.QtSql.QSqlRelationalDelegate 对象采用给定 parent .