Q3DataView Class Reference

#include <q3dataview.h>

Inheritance diagram for Q3DataView:

Inheritance graph
[legend]
Collaboration diagram for Q3DataView:

Collaboration graph
[legend]
List of all members.

Detailed Description

The Q3DataView class provides read-only SQL forms.

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

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.

Definition at line 39 of file q3dataview.h.

Public Slots

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

Public Member Functions

 Q3DataView (QWidget *parent=0, const char *name=0, Qt::WindowFlags fl=0)
 ~Q3DataView ()
virtual void setForm (Q3SqlForm *form)
Q3SqlFormform ()
virtual void setRecord (QSqlRecord *record)
QSqlRecordrecord ()

Private Attributes

Q3DataViewPrivated


Constructor & Destructor Documentation

Q3DataView::Q3DataView ( QWidget parent = 0,
const char *  name = 0,
Qt::WindowFlags  fl = 0 
)

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

Definition at line 64 of file q3dataview.cpp.

References d.

00065     : QWidget(parent, name, fl)
00066 {
00067     d = new Q3DataViewPrivate();
00068 }

Q3DataView::~Q3DataView (  ) 

Destroys the object and frees any allocated resources.

Definition at line 74 of file q3dataview.cpp.

References d.

00075 {
00076     delete d;
00077 }


Member Function Documentation

void Q3DataView::setForm ( Q3SqlForm 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()

Definition at line 98 of file q3dataview.cpp.

References d, form(), Q3DataViewPrivate::frm, and Q3SqlFormManager::setForm().

00099 {
00100     d->frm.setForm(form);
00101 }

Here is the call graph for this function:

Q3SqlForm * Q3DataView::form (  ) 

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

See also:
setForm()

Definition at line 111 of file q3dataview.cpp.

References d, Q3SqlFormManager::form(), and Q3DataViewPrivate::frm.

Referenced by setForm().

00112 {
00113     return d->frm.form();
00114 }

Here is the call graph for this function:

void Q3DataView::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()

Definition at line 125 of file q3dataview.cpp.

References d, Q3DataViewPrivate::frm, record(), and Q3SqlFormManager::setRecord().

Referenced by refresh().

00126 {
00127     d->frm.setRecord(record);
00128 }

Here is the call graph for this function:

QSqlRecord * Q3DataView::record (  ) 

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

See also:
setRecord()

Definition at line 138 of file q3dataview.cpp.

References d, Q3DataViewPrivate::frm, and Q3SqlFormManager::record().

Referenced by refresh(), and setRecord().

00139 {
00140     return d->frm.record();
00141 }

Here is the call graph for this function:

void Q3DataView::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() readFields()

Definition at line 182 of file q3dataview.cpp.

References buf, readFields(), record(), and setRecord().

00183 {
00184     if (buf && buf != record())
00185         setRecord(buf);
00186     readFields();
00187 }

void Q3DataView::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()

Definition at line 151 of file q3dataview.cpp.

References d, Q3DataViewPrivate::frm, and Q3SqlFormManager::readFields().

Referenced by refresh().

00152 {
00153     d->frm.readFields();
00154 }

void Q3DataView::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()

Definition at line 163 of file q3dataview.cpp.

References d, Q3DataViewPrivate::frm, and Q3SqlFormManager::writeFields().

00164 {
00165     d->frm.writeFields();
00166 }

void Q3DataView::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.

Definition at line 85 of file q3dataview.cpp.

References Q3SqlFormManager::clearValues(), d, and Q3DataViewPrivate::frm.

00086 {
00087     d->frm.clearValues();
00088 }


Member Data Documentation

Q3DataViewPrivate* Q3DataView::d [private]

Definition at line 61 of file q3dataview.h.

Referenced by clearValues(), form(), Q3DataView(), readFields(), record(), setForm(), setRecord(), writeFields(), and ~Q3DataView().


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 15:49:51 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1