Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QSqlRelationalDelegate Class

TheQSqlRelationalDelegate class provides a delegate that is used to display and edit data from aQSqlRelationalTableModel.More...

Header:#include <QSqlRelationalDelegate>
Inherits:QItemDelegate

Public Functions

Reimplemented Public Functions

virtual QWidget *createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const
virtual voidsetEditorData(QWidget * editor, const QModelIndex & index) const
virtual voidsetModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const

Additional Inherited Members

Detailed Description

TheQSqlRelationalDelegate class provides a delegate that is used to display and edit data from aQSqlRelationalTableModel.

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

QTableView*view=newQTableView;    view->setModel(model);    view->setItemDelegate(newQSqlRelationalDelegate(view));

TheRelational Table Model example (shown below) illustrates how to useQSqlRelationalDelegate in conjunction withQSqlRelationalTableModel to provide tables with foreign key support.

See alsoQSqlRelationalTableModel andModel/View Programming.

Member Function Documentation

QSqlRelationalDelegate::QSqlRelationalDelegate(QObject * parent = 0)

Constructs aQSqlRelationalDelegate object with the givenparent.

QSqlRelationalDelegate::~QSqlRelationalDelegate()

Destroys theQSqlRelationalDelegate object and frees any allocated resources.

[virtual]QWidget * QSqlRelationalDelegate::createEditor(QWidget * parent, constQStyleOptionViewItem & option, constQModelIndex & index) const

Reimplemented fromQAbstractItemDelegate::createEditor().

[virtual]void QSqlRelationalDelegate::setEditorData(QWidget * editor, constQModelIndex & index) const

Reimplemented fromQAbstractItemDelegate::setEditorData().

[virtual]void QSqlRelationalDelegate::setModelData(QWidget * editor,QAbstractItemModel * model, constQModelIndex & index) const

Reimplemented fromQAbstractItemDelegate::setModelData().

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp