TQDataView Class

Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# TQDataView Class Reference
[sql module]

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

`#include <ntqdataview.h>`

Inherits TQWidget.

List of all member functions.

## Public Members

- TQDataView ( TQWidget * parent = 0, const char * name = 0, WFlags fl = 0 )
- ~TQDataView ()
- virtual void setForm ( TQSqlForm * form )
- TQSqlForm * form ()
- virtual void setRecord ( TQSqlRecord * record )
- TQSqlRecord * record ()

## Public Slots

- virtual void refresh ( TQSqlRecord * buf )
- virtual void readFields ()
- virtual void writeFields ()
- virtual void clearValues ()

## Detailed Description

The TQDataView class provides read-only SQL forms.

This class provides a form which displays SQL field data from a record buffer. Because TQDataView does not support editing it uses less resources than a TQDataBrowser. 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 TQDataBrowser; if you want a table-based presentation of your data use TQDataTable.

The form is associated with the data view with setForm() and the record is associated with setRecord(). You can also pass a TQSqlRecord 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

### TQDataView::TQDataView ( TQWidget * 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.

### TQDataView::~TQDataView ()

Destroys the object and frees any allocated resources.

### void TQDataView::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.

### TQSqlForm * TQDataView::form ()

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

See also setForm().

### void TQDataView::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().

### TQSqlRecord * TQDataView::record ()

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

See also setRecord().

### void TQDataView::refresh ( TQSqlRecord * 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 TQDataView::setForm ( TQSqlForm * 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 TQDataView::setRecord ( TQSqlRecord * 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 TQDataView::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().

This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.