---
name: "qdataview"
section: "3qt"
platform: "linux"
package: "qt3-doc"
version: "3:3.3.8b-7"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/qdataview"
---

# qdataview(3qt)

Read-only SQL forms

## NAME

QDataView - Read-only SQL forms

## SYNOPSIS

`#include <qdataview.h>`

Inherits QWidget.

### Public Members

**QDataView ( QWidget \* parent = 0, const char \* name = 0, WFlags fl = 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 ()**\

## 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, const char \* name = 0, WFlags fl = 0 )

Constructs a data view which is a child of *parent*, called *name*, and with widget flags *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().

## SEE ALSO

**http://doc.trolltech.com/qdataview.html** **http://www.trolltech.com/faq/tech.html**

## COPYRIGHT

Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the license file included in the distribution for a complete license statement.

## AUTHOR

Generated automatically from the source code.

## BUGS

If you find a bug in Qt, please report it as described in **http://doc.trolltech.com/bughowto.html**. Good bug reports help us to help you. Thank you.

The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.

If you find errors in this manual page, please report them to **qt-bugs@trolltech.com**. Please include the name of the manual page (qdataview.3qt) and the Qt version (3.3.8).
