返回介绍

QDataView Class

发布于 2019-10-04 14:59:22 字数 3941 浏览 1123 评论 0 收藏 0

The QDataView class provides read-only SQL forms.
More...

#include <qdataview.h>

Inherits QWidget.

List of all member functions.

Public Members

  • QDataView ( QWidget*parent = 0, constchar*name = 0, WFlagsfl = 0 )
  • ~QDataView ()
  • virtual void setForm ( QSqlForm*form )
  • QSqlForm * form ()
  • virtual void setRecord ( QSqlRecord*record )
  • QSqlRecord * record ()

Public Slots

  • virtual void refresh ( QSqlRecord*buf )
  • virtual void readFields ()
  • virtual void writeFields ()
  • virtual void clearValues ()

Detailed Description

The QDataView class provides read-only SQL forms.

This class provides a form which displays SQL field data from a
record buffer. Because QDataView does not support editing it uses
less resources than a QDataBrowser. This class is well suited for
displaying read-only data from a SQL database.

If you want a to present your data in an editable form use
QDataBrowser; if you want a table-based presentation of your data
use QDataTable.

The form is associated with the data view with setForm() and the
record is associated with setRecord(). You can also pass a
QSqlRecord to the refresh() function which will set the record to
the given record and read the record's fields into the form.

See also Database Classes.


Member Function Documentation

QDataView::QDataView ( QWidget*parent = 0, constchar*name = 0, WFlagsfl = 0 )

Constructs a data view which is a child of parent, with the
name name and widget flags set to fl.

QDataView::~QDataView ()

Destroys the object and frees any allocated resources.

void QDataView::clearValues () [virtual slot]

Clears the default form's values. If there is no default form,
nothing happens. All the values are set to their 'zero state', e.g. 0
for numeric fields, "" for string fields.

QSqlForm* QDataView::form ()

Returns the default form used by the data view, or 0 if there is
none.

See also setForm().

void QDataView::readFields () [virtual slot]

Causes the default form to read its fields from the record buffer. If
there is no default form, or no record, nothing happens.

See also setForm().

QSqlRecord* QDataView::record ()

Returns the default record used by the data view, or 0 if there is
none.

See also setRecord().

void QDataView::refresh ( QSqlRecord*buf ) [virtual slot]

Causes the default form to display the contents of buf. If
there is no default form, nothing happens.The buf also becomes
the default record for all subsequent calls to readFields() and
writefields(). This slot is equivalant to calling:

  myView.setRecord( record );
  myView.readFields();
  

See also setRecord() and readFields().

void QDataView::setForm ( QSqlForm*form ) [virtual]

Sets the form used by the data view to form. If a record has
already been assigned to the data view, the form will display that
record's data.

See also form().

void QDataView::setRecord ( QSqlRecord*record ) [virtual]

Sets the record used by the data view to record. If a form has
already been assigned to the data view, the form will display the
data from record in that form.

See also record().

void QDataView::writeFields () [virtual slot]

Causes the default form to write its fields to the record buffer.
If there is no default form, or no record, nothing happens.

See also setForm().

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文