Eneboo - Documentación para desarrolladores
Tipos públicos | Slots públicos | Señales | Métodos públicos | Métodos protegidos | Propiedades
Referencia de la Clase QDataBrowser

The QDataBrowser class provides data manipulation and navigation for data entry forms. Más...

#include <qdatabrowser.h>

Diagrama de herencias de QDataBrowser
QWidget QWidget QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject QDesignerDataBrowser QDesignerDataBrowser2

Lista de todos los miembros.

Tipos públicos

enum  Boundary {
  Unknown, None, BeforeBeginning, Beginning,
  End, AfterEnd, Unknown, None,
  BeforeBeginning, Beginning, End, AfterEnd
}
enum  Boundary {
  Unknown, None, BeforeBeginning, Beginning,
  End, AfterEnd, Unknown, None,
  BeforeBeginning, Beginning, End, AfterEnd
}

Slots públicos

virtual void refresh ()
virtual void insert ()
virtual void update ()
virtual void del ()
virtual void first ()
virtual void last ()
virtual void next ()
virtual void prev ()
virtual void readFields ()
virtual void writeFields ()
virtual void clearValues ()
void updateBoundary ()
virtual void refresh ()
virtual void insert ()
virtual void update ()
virtual void del ()
virtual void first ()
virtual void last ()
virtual void next ()
virtual void prev ()
virtual void readFields ()
virtual void writeFields ()
virtual void clearValues ()
void updateBoundary ()

Señales

void firstRecordAvailable (bool available)
void lastRecordAvailable (bool available)
void nextRecordAvailable (bool available)
void prevRecordAvailable (bool available)
void currentChanged (const QSqlRecord *record)
void primeInsert (QSqlRecord *buf)
void primeUpdate (QSqlRecord *buf)
void primeDelete (QSqlRecord *buf)
void beforeInsert (QSqlRecord *buf)
void beforeUpdate (QSqlRecord *buf)
void beforeDelete (QSqlRecord *buf)
void cursorChanged (QSqlCursor::Mode mode)
void firstRecordAvailable (bool available)
void lastRecordAvailable (bool available)
void nextRecordAvailable (bool available)
void prevRecordAvailable (bool available)
void currentChanged (const QSqlRecord *record)
void primeInsert (QSqlRecord *buf)
void primeUpdate (QSqlRecord *buf)
void primeDelete (QSqlRecord *buf)
void beforeInsert (QSqlRecord *buf)
void beforeUpdate (QSqlRecord *buf)
void beforeDelete (QSqlRecord *buf)
void cursorChanged (QSqlCursor::Mode mode)

Métodos públicos

 QDataBrowser (QWidget *parent=0, const char *name=0, WFlags fl=0)
 ~QDataBrowser ()
Boundary boundary ()
void setBoundaryChecking (bool active)
bool boundaryChecking () const
void setSort (const QSqlIndex &sort)
void setSort (const QStringList &sort)
QStringList sort () const
void setFilter (const QString &filter)
QString filter () const
virtual void setSqlCursor (QSqlCursor *cursor, bool autoDelete=FALSE)
QSqlCursorsqlCursor () const
virtual void setForm (QSqlForm *form)
QSqlFormform ()
virtual void setConfirmEdits (bool confirm)
virtual void setConfirmInsert (bool confirm)
virtual void setConfirmUpdate (bool confirm)
virtual void setConfirmDelete (bool confirm)
virtual void setConfirmCancels (bool confirm)
bool confirmEdits () const
bool confirmInsert () const
bool confirmUpdate () const
bool confirmDelete () const
bool confirmCancels () const
virtual void setReadOnly (bool active)
bool isReadOnly () const
virtual void setAutoEdit (bool autoEdit)
bool autoEdit () const
virtual bool seek (int i, bool relative=FALSE)
 QDataBrowser (QWidget *parent=0, const char *name=0, WFlags fl=0)
 ~QDataBrowser ()
Boundary boundary ()
void setBoundaryChecking (bool active)
bool boundaryChecking () const
void setSort (const QSqlIndex &sort)
void setSort (const QStringList &sort)
QStringList sort () const
void setFilter (const QString &filter)
QString filter () const
virtual void setSqlCursor (QSqlCursor *cursor, bool autoDelete=FALSE)
QSqlCursorsqlCursor () const
virtual void setForm (QSqlForm *form)
QSqlFormform ()
virtual void setConfirmEdits (bool confirm)
virtual void setConfirmInsert (bool confirm)
virtual void setConfirmUpdate (bool confirm)
virtual void setConfirmDelete (bool confirm)
virtual void setConfirmCancels (bool confirm)
bool confirmEdits () const
bool confirmInsert () const
bool confirmUpdate () const
bool confirmDelete () const
bool confirmCancels () const
virtual void setReadOnly (bool active)
bool isReadOnly () const
virtual void setAutoEdit (bool autoEdit)
bool autoEdit () const
virtual bool seek (int i, bool relative=FALSE)

Métodos protegidos

virtual bool insertCurrent ()
virtual bool updateCurrent ()
virtual bool deleteCurrent ()
virtual bool currentEdited ()
virtual QSql::Confirm confirmEdit (QSql::Op m)
virtual QSql::Confirm confirmCancel (QSql::Op m)
virtual void handleError (const QSqlError &error)
virtual bool insertCurrent ()
virtual bool updateCurrent ()
virtual bool deleteCurrent ()
virtual bool currentEdited ()
virtual QSql::Confirm confirmEdit (QSql::Op m)
virtual QSql::Confirm confirmCancel (QSql::Op m)
virtual void handleError (const QSqlError &error)

Propiedades

bool boundaryChecking
 whether boundary checking is active
QString filter
 the data browser's filter
QStringList sort
 the data browser's sort
bool confirmEdits
 whether the browser confirms edits
bool confirmInsert
 whether the data browser confirms insertions
bool confirmUpdate
 whether the browser confirms updates
bool confirmDelete
 whether the browser confirms deletions
bool confirmCancels
 whether the browser confirms cancel operations
bool readOnly
 whether the browser is read-only
bool autoEdit
 whether the browser automatically applies edits

Descripción detallada

The QDataBrowser class provides data manipulation and navigation for data entry forms.

sql

A high-level API is provided for navigating through data records in a cursor, for inserting, updating and deleting records, and for refreshing data in the display.

If you want a read-only form to present database data use QDataView; if you want a table-based presentation of your data use QDataTable.

A QDataBrowser is used to associate a dataset with a form in much the same way as a QDataTable associates a dataset with a table. Once the data browser has been constructed it can be associated with a dataset with setSqlCursor(), and with a form with setForm(). Boundary checking, sorting and filtering can be set with setBoundaryChecking(), setSort() and setFilter(), respectively.

The insertCurrent() function reads the fields from the default form into the default cursor and performs the insert. The updateCurrent() and deleteCurrent() functions perform similarly to update and delete the current record respectively.

The user can be asked to confirm all edits with setConfirmEdits(). For more precise control use setConfirmInsert(), setConfirmUpdate(), setConfirmDelete() and setConfirmCancels(). Use setAutoEdit() to control the behaviour of the form when the user edits a record and then navigates.

The record set is navigated using first(), next(), prev(), last() and seek(). The form's display is updated with refresh(). When navigation takes place the firstRecordAvailable(), lastRecordAvailable(), nextRecordAvailable() and prevRecordAvailable() signals are emitted. When the cursor record is changed due to navigation the cursorChanged() signal is emitted.

If you want finer control of the insert, update and delete processes then you can use the lower level functions to perform these operations as described below.

The form is populated with data from the database with readFields(). If the user is allowed to edit, (see setReadOnly()), write the form's data back to the cursor's edit buffer with writeFields(). You can clear the values in the form with clearValues(). Editing is performed as follows: insert When the data browser enters insertion mode it emits the primeInsert() signal which you can connect to, for example to pre-populate fields. Call writeFields() to write the user's edits to the cursor's edit buffer then call insert() to insert the record into the database. The beforeInsert() signal is emitted just before the cursor's edit buffer is inserted into the database; connect to this for example, to populate fields such as an auto-generated primary key. update For updates the primeUpdate() signal is emitted when the data browser enters update mode. After calling writeFields() call update() to update the record and connect to the beforeUpdate() signal to manipulate the user's data before the update takes place. delete For deletion the primeDelete() signal is emitted when the data browser enters deletion mode. After calling writeFields() call del() to delete the record and connect to the beforeDelete() signal, for example to record an audit of the deleted record.


Documentación de las enumeraciones miembro de la clase

This enum describes where the data browser is positioned.

Unknown the boundary cannot be determined (usually because there is no default cursor, or the default cursor is not active).

None the browser is not positioned on a boundary, but it is positioned on a record somewhere in the middle.

BeforeBeginning the browser is positioned before the first available record.

Beginning the browser is positioned at the first record.

End the browser is positioned at the last record.

AfterEnd the browser is positioned after the last available record.

Valores de enumeraciones:
Unknown 
None 
BeforeBeginning 
Beginning 
End 
AfterEnd 
Unknown 
None 
BeforeBeginning 
Beginning 
End 
AfterEnd 
Valores de enumeraciones:
Unknown 
None 
BeforeBeginning 
Beginning 
End 
AfterEnd 
Unknown 
None 
BeforeBeginning 
Beginning 
End 
AfterEnd 

Documentación del constructor y destructor

QDataBrowser::QDataBrowser ( QWidget parent = 0,
const char *  name = 0,
WFlags  fl = 0 
)

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

QDataBrowser::~QDataBrowser ( )

Destroys the object and frees any allocated resources.

QDataBrowser::QDataBrowser ( QWidget parent = 0,
const char *  name = 0,
WFlags  fl = 0 
)
QDataBrowser::~QDataBrowser ( )

Documentación de las funciones miembro

bool QDataBrowser::autoEdit ( ) const
bool QDataBrowser::autoEdit ( ) const
void QDataBrowser::beforeDelete ( QSqlRecord buf) [signal]

This signal is emitted just before the cursor's edit buffer is deleted from the database. The buf parameter points to the edit buffer being deleted. You might connect to this signal to capture some auditing information about the deletion.

void QDataBrowser::beforeDelete ( QSqlRecord buf) [signal]
void QDataBrowser::beforeInsert ( QSqlRecord buf) [signal]

This signal is emitted just before the cursor's edit buffer is inserted into the database. The buf parameter points to the edit buffer being inserted. You might connect to this signal to populate a generated primary key for example.

void QDataBrowser::beforeInsert ( QSqlRecord buf) [signal]
void QDataBrowser::beforeUpdate ( QSqlRecord buf) [signal]

This signal is emitted just before the cursor's edit buffer is updated in the database. The buf parameter points to the edit buffer being updated. You might connect to this signal to capture some auditing information about the update.

void QDataBrowser::beforeUpdate ( QSqlRecord buf) [signal]
QDataBrowser::Boundary QDataBrowser::boundary ( )

Returns an enum indicating the boundary status of the browser.

This is achieved by moving the default cursor and checking the position, however the current default form values will not be altered. After checking for the boundary, the cursor is moved back to its former position. See QDataBrowser::Boundary.

Ver también:
Boundary
Boundary QDataBrowser::boundary ( )
bool QDataBrowser::boundaryChecking ( ) const
bool QDataBrowser::boundaryChecking ( ) const
void QDataBrowser::clearValues ( ) [virtual, slot]

Clears all the values in the form.

All the edit buffer field values are set to their 'zero state', e.g. 0 for numeric fields and "" for string fields. Then the widgets are updated using the property map. For example, a combobox that is property-mapped to integers would scroll to the first item. See the QSqlPropertyMap constructor for the default mappings of widgets to properties.

virtual void QDataBrowser::clearValues ( ) [virtual, slot]
QSql::Confirm QDataBrowser::confirmCancel ( QSql::Op  m) [protected, virtual]

Protected virtual function which returns a confirmation for cancelling an edit mode m. Derived classes can reimplement this function and provide their own confirmation dialog. The default implementation uses a message box which prompts the user to confirm the edit action.

virtual QSql::Confirm QDataBrowser::confirmCancel ( QSql::Op  m) [protected, virtual]
bool QDataBrowser::confirmCancels ( ) const
bool QDataBrowser::confirmCancels ( ) const
bool QDataBrowser::confirmDelete ( ) const
bool QDataBrowser::confirmDelete ( ) const
virtual QSql::Confirm QDataBrowser::confirmEdit ( QSql::Op  m) [protected, virtual]
QSql::Confirm QDataBrowser::confirmEdit ( QSql::Op  m) [protected, virtual]

Protected virtual function which returns a confirmation for an edit of mode m. Derived classes can reimplement this function and provide their own confirmation dialog. The default implementation uses a message box which prompts the user to confirm the edit action.

bool QDataBrowser::confirmEdits ( ) const
bool QDataBrowser::confirmEdits ( ) const
bool QDataBrowser::confirmInsert ( ) const
bool QDataBrowser::confirmInsert ( ) const
bool QDataBrowser::confirmUpdate ( ) const
bool QDataBrowser::confirmUpdate ( ) const
void QDataBrowser::currentChanged ( const QSqlRecord record) [signal]

This signal is emitted whenever the current cursor position changes. The record parameter points to the contents of the current cursor's record.

void QDataBrowser::currentChanged ( const QSqlRecord record) [signal]
virtual bool QDataBrowser::currentEdited ( ) [protected, virtual]
bool QDataBrowser::currentEdited ( ) [protected, virtual]

Returns TRUE if the form's edit buffer differs from the current cursor buffer; otherwise returns FALSE.

void QDataBrowser::cursorChanged ( QSqlCursor::Mode  mode) [signal]

This signal is emitted whenever the cursor record was changed due to navigation. The mode parameter is the edit that just took place, e.g. Insert, Update or Delete. See QSqlCursor::Mode.

void QDataBrowser::cursorChanged ( QSqlCursor::Mode  mode) [signal]
void QDataBrowser::del ( ) [virtual, slot]

Performs a delete operation on the data browser's cursor. If there is no default cursor or no default form, nothing happens.

Otherwise, the following happens:

The current form's record is deleted from the database, providing that the data browser is not in insert mode. If the data browser is actively inserting a record (see insert()), the insert action is canceled, and the browser navigates to the last valid record that was current. If there is an error, handleError() is called.

virtual void QDataBrowser::del ( ) [virtual, slot]
bool QDataBrowser::deleteCurrent ( ) [protected, virtual]

Performs a delete on the default cursor using the values from the default form and updates the default form. If there is no default form or no default cursor, nothing happens. If the deletion was successful, the cursor is repositioned to the nearest record and TRUE is returned. The nearest record is the next record if there is one otherwise the previous record if there is one. If an error occurred during the deletion from the database, handleError() is called and FALSE is returned.

Ver también:
cursor() form() handleError()
virtual bool QDataBrowser::deleteCurrent ( ) [protected, virtual]
QString QDataBrowser::filter ( ) const
QString QDataBrowser::filter ( ) const
void QDataBrowser::first ( ) [virtual, slot]

Moves the default cursor to the first record and refreshes the default form to display this record. If there is no default form or no default cursor, nothing happens. If the data browser successfully navigated to the first record, the default cursor is primed for update and the primeUpdate() signal is emitted.

If the browser is already positioned on the first record nothing happens.

virtual void QDataBrowser::first ( ) [virtual, slot]
void QDataBrowser::firstRecordAvailable ( bool  available) [signal]
void QDataBrowser::firstRecordAvailable ( bool  available) [signal]

This signal is emitted whenever the position of the cursor changes. The available parameter indicates whether or not the first record in the default cursor is available.

QSqlForm* QDataBrowser::form ( )
QSqlForm * QDataBrowser::form ( )

Returns the data browser's default form or 0 if no form has been set.

virtual void QDataBrowser::handleError ( const QSqlError error) [protected, virtual]
void QDataBrowser::handleError ( const QSqlError error) [protected, virtual]

Virtual function which handles the error error. The default implementation warns the user with a message box.

void QDataBrowser::insert ( ) [virtual, slot]

Performs an insert operation on the data browser's cursor. If there is no default cursor or no default form, nothing happens.

If auto-editing is on (see setAutoEdit()), the following happens:

If the browser is already actively inserting a record, the current form's data is inserted into the database. If the browser is not inserting a record, but the current record was changed by the user, the record is updated in the database with the current form's data (i.e. with the changes).

If there is an error handling any of the above auto-edit actions, handleError() is called and no insert or update is performed.

If no error occurred, or auto-editing is not enabled, the data browser begins actively inserting a record into the database by performing the following actions:

The default cursor is primed for insert using QSqlCursor::primeInsert(). The primeInsert() signal is emitted. The form is updated with the values in the default cursor's. edit buffer so that the user can fill in the values to be inserted.

virtual void QDataBrowser::insert ( ) [virtual, slot]
virtual bool QDataBrowser::insertCurrent ( ) [protected, virtual]
bool QDataBrowser::insertCurrent ( ) [protected, virtual]

Reads the fields from the default form into the default cursor and performs an insert on the default cursor. If there is no default form or no default cursor, nothing happens. If an error occurred during the insert into the database, handleError() is called and FALSE is returned. If the insert was successfull, the cursor is refreshed and relocated to the newly inserted record, the cursorChanged() signal is emitted, and TRUE is returned.

Ver también:
cursorChanged() sqlCursor() form() handleError()
bool QDataBrowser::isReadOnly ( ) const
bool QDataBrowser::isReadOnly ( ) const
void QDataBrowser::last ( ) [virtual, slot]

Moves the default cursor to the last record and refreshes the default form to display this record. If there is no default form or no default cursor, nothing happens. If the data browser successfully navigated to the last record, the default cursor is primed for update and the primeUpdate() signal is emitted.

If the browser is already positioned on the last record nothing happens.

virtual void QDataBrowser::last ( ) [virtual, slot]
void QDataBrowser::lastRecordAvailable ( bool  available) [signal]
void QDataBrowser::lastRecordAvailable ( bool  available) [signal]

This signal is emitted whenever the position of the cursor changes. The available parameter indicates whether or not the last record in the default cursor is available.

void QDataBrowser::next ( ) [virtual, slot]

Moves the default cursor to the next record and refreshes the default form to display this record. If there is no default form or no default cursor, nothing happens. If the data browser successfully navigated to the next record, the default cursor is primed for update and the primeUpdate() signal is emitted.

If the browser is positioned on the last record nothing happens.

virtual void QDataBrowser::next ( ) [virtual, slot]
void QDataBrowser::nextRecordAvailable ( bool  available) [signal]
void QDataBrowser::nextRecordAvailable ( bool  available) [signal]

This signal is emitted whenever the position of the cursor changes. The available parameter indicates whether or not the next record in the default cursor is available.

void QDataBrowser::prev ( ) [virtual, slot]

Moves the default cursor to the previous record and refreshes the default form to display this record. If there is no default form or no default cursor, nothing happens. If the data browser successfully navigated to the previous record, the default cursor is primed for update and the primeUpdate() signal is emitted.

If the browser is positioned on the first record nothing happens.

virtual void QDataBrowser::prev ( ) [virtual, slot]
void QDataBrowser::prevRecordAvailable ( bool  available) [signal]
void QDataBrowser::prevRecordAvailable ( bool  available) [signal]

This signal is emitted whenever the position of the cursor changes. The available parameter indicates whether or not the previous record in the default cursor is available.

void QDataBrowser::primeDelete ( QSqlRecord buf) [signal]

This signal is emitted when the data browser enters deletion mode. The buf parameter points to the record buffer being deleted. (Note that QSqlCursor::primeDelete() is not called on the default cursor, as this would corrupt values in the form.) Connect to this signal in order to, for example, save a copy of the deleted record for auditing purposes.

Ver también:
del()
void QDataBrowser::primeDelete ( QSqlRecord buf) [signal]
void QDataBrowser::primeInsert ( QSqlRecord buf) [signal]

This signal is emitted when the data browser enters insertion mode. The buf parameter points to the record buffer that is to be inserted. Connect to this signal to, for example, prime the record buffer with default data values, auto-numbered fields etc. (Note that QSqlCursor::primeInsert() is not called on the default cursor, as this would corrupt values in the form.)

Ver también:
insert()
void QDataBrowser::primeInsert ( QSqlRecord buf) [signal]
void QDataBrowser::primeUpdate ( QSqlRecord buf) [signal]

This signal is emitted when the data browser enters update mode. Note that during navigation (first(), last(), next(), prev()), each record that is shown in the default form is primed for update. The buf parameter points to the record buffer being updated. (Note that QSqlCursor::primeUpdate() is not called on the default cursor, as this would corrupt values in the form.) Connect to this signal in order to, for example, keep track of which records have been updated, perhaps for auditing purposes.

Ver también:
update()
void QDataBrowser::primeUpdate ( QSqlRecord buf) [signal]
virtual void QDataBrowser::readFields ( ) [virtual, slot]
void QDataBrowser::readFields ( ) [virtual, slot]

Reads the fields from the default cursor's edit buffer and displays them in the form. If there is no default cursor or no default form, nothing happens.

void QDataBrowser::refresh ( ) [virtual, slot]

Refreshes the data browser's data using the default cursor. The browser's current filter and sort are applied if they have been set.

Ver también:
setFilter() setSort()
virtual void QDataBrowser::refresh ( ) [virtual, slot]
bool QDataBrowser::seek ( int  i,
bool  relative = FALSE 
) [virtual]

Moves the default cursor to the record specified by the index i and refreshes the default form to display this record. If there is no default form or no default cursor, nothing happens. If relative is TRUE (the default is FALSE), the cursor is moved relative to its current position. If the data browser successfully navigated to the desired record, the default cursor is primed for update and the primeUpdate() signal is emitted.

If the browser is already positioned on the desired record nothing happens.

virtual bool QDataBrowser::seek ( int  i,
bool  relative = FALSE 
) [virtual]
void QDataBrowser::setAutoEdit ( bool  autoEdit) [virtual]
virtual void QDataBrowser::setAutoEdit ( bool  autoEdit) [virtual]
void QDataBrowser::setBoundaryChecking ( bool  active)
void QDataBrowser::setBoundaryChecking ( bool  active)
void QDataBrowser::setConfirmCancels ( bool  confirm) [virtual]
virtual void QDataBrowser::setConfirmCancels ( bool  confirm) [virtual]
void QDataBrowser::setConfirmDelete ( bool  confirm) [virtual]
virtual void QDataBrowser::setConfirmDelete ( bool  confirm) [virtual]
virtual void QDataBrowser::setConfirmEdits ( bool  confirm) [virtual]
void QDataBrowser::setConfirmEdits ( bool  confirm) [virtual]
virtual void QDataBrowser::setConfirmInsert ( bool  confirm) [virtual]
void QDataBrowser::setConfirmInsert ( bool  confirm) [virtual]
virtual void QDataBrowser::setConfirmUpdate ( bool  confirm) [virtual]
void QDataBrowser::setConfirmUpdate ( bool  confirm) [virtual]
void QDataBrowser::setFilter ( const QString filter)
void QDataBrowser::setFilter ( const QString filter)
void QDataBrowser::setForm ( QSqlForm form) [virtual]

Sets the browser's default form to form. The cursor and all navigation and data manipulation functions that the browser provides become available to the form.

virtual void QDataBrowser::setForm ( QSqlForm form) [virtual]
void QDataBrowser::setReadOnly ( bool  active) [virtual]
virtual void QDataBrowser::setReadOnly ( bool  active) [virtual]
void QDataBrowser::setSort ( const QStringList sort)
void QDataBrowser::setSort ( const QStringList sort)
void QDataBrowser::setSort ( const QSqlIndex sort)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Sets the data browser's sort to the QSqlIndex sort. To apply the new sort, use refresh().

void QDataBrowser::setSort ( const QSqlIndex sort)
virtual void QDataBrowser::setSqlCursor ( QSqlCursor cursor,
bool  autoDelete = FALSE 
) [virtual]
void QDataBrowser::setSqlCursor ( QSqlCursor cursor,
bool  autoDelete = FALSE 
) [virtual]

Sets the default cursor used by the data browser to cursor. If autoDelete is TRUE (the default is FALSE), the data browser takes ownership of the cursor pointer, which will be deleted when the browser is destroyed, or when setSqlCursor() is called again. To activate the cursor use refresh(). The cursor's edit buffer is used in the default form to browse and edit records.

Ver también:
sqlCursor() form() setForm()
QStringList QDataBrowser::sort ( ) const
QStringList QDataBrowser::sort ( ) const
QSqlCursor * QDataBrowser::sqlCursor ( ) const

Returns the default cursor used for navigation, or 0 if there is no default cursor.

Ver también:
setSqlCursor()
QSqlCursor* QDataBrowser::sqlCursor ( ) const
virtual void QDataBrowser::update ( ) [virtual, slot]

Updates the widget unless updates are disabled or the widget is hidden.

Updating the widget will erase the widget contents and generate an appropriate paint event for the invalidated region. The paint event is processed after the program has returned to the main event loop. Calling update() many times in a row will generate a single paint event.

If the widgets sets the WRepaintNoErase flag, update() will not erase its contents.

Ver también:
repaint(), paintEvent(), setUpdatesEnabled(), erase(), setWFlags()

Updates the widget unless updates are disabled or the widget is hidden.

This function does not cause an immediate repaint; instead it schedules a paint event for processing when Qt returns to the main event loop. This permits Qt to optimize for more speed and less flicker than a call to repaint() does.

Calling update() several times normally results in just one paintEvent() call.

Qt normally erases the widget's area before the paintEvent() call. If the WRepaintNoErase widget flag is set, the widget is responsible for painting all its pixels itself.

Ver también:
repaint(), paintEvent(), setUpdatesEnabled(), erase(), setWFlags()

Reimplementado de QWidget.

void QDataBrowser::update ( ) [virtual, slot]

Performs an update operation on the data browser's cursor.

If there is no default cursor or no default form, nothing happens. Otherwise, the following happens:

If the data browser is actively inserting a record (see insert()), that record is inserted into the database using insertCurrent(). Otherwise, the database is updated with the current form's data using updateCurrent(). If there is an error handling either action, handleError() is called.

Reimplementado de QWidget.

void QDataBrowser::updateBoundary ( ) [slot]

If boundaryChecking() is TRUE, checks the boundary of the current default cursor and emits signals which indicate the position of the cursor.

void QDataBrowser::updateBoundary ( ) [slot]
bool QDataBrowser::updateCurrent ( ) [protected, virtual]

Reads the fields from the default form into the default cursor and performs an update on the default cursor. If there is no default form or no default cursor, nothing happens. If an error occurred during the update on the database, handleError() is called and FALSE is returned. If the update was successfull, the cursor is refreshed and relocated to the updated record, the cursorChanged() signal is emitted, and TRUE is returned.

Ver también:
cursor() form() handleError()
virtual bool QDataBrowser::updateCurrent ( ) [protected, virtual]
virtual void QDataBrowser::writeFields ( ) [virtual, slot]
void QDataBrowser::writeFields ( ) [virtual, slot]

Writes the form's data to the default cursor's edit buffer. If there is no default cursor or no default form, nothing happens.


Documentación de propiedades

bool QDataBrowser::autoEdit [read, write]

whether the browser automatically applies edits

The default value for this property is TRUE. When the user begins an insertion or an update on a form there are two possible outcomes when they navigate to another record:

the insert or update is is performed -- this occurs if autoEdit is TRUE the insert or update is discarded -- this occurs if autoEdit is FALSE

bool QDataBrowser::boundaryChecking [read, write]

whether boundary checking is active

When boundary checking is active (the default), signals are emitted indicating the current position of the default cursor.

Ver también:
boundary()
bool QDataBrowser::confirmCancels [read, write]

whether the browser confirms cancel operations

If this property is TRUE, all cancels must be confirmed by the user through a message box (this behavior can be changed by overriding the confirmCancel() function), otherwise all cancels occur immediately. The default is FALSE.

Ver también:
confirmEdits() confirmCancel()
bool QDataBrowser::confirmDelete [read, write]

whether the browser confirms deletions

If this property is TRUE, the browser confirms deletions, otherwise deletions happen immediately.

Ver también:
confirmCancels() confirmEdits() confirmUpdate() confirmInsert() confirmEdit()
bool QDataBrowser::confirmEdits [read, write]

whether the browser confirms edits

If this property is TRUE, the browser confirms all edit operations (insertions, updates and deletions), otherwise all edit operations happen immediately. Confirmation is achieved by presenting the user with a message box -- this behavior can be changed by reimplementing the confirmEdit() function,

Ver también:
confirmEdit() confirmCancels() confirmInsert() confirmUpdate() confirmDelete()
bool QDataBrowser::confirmInsert [read, write]

whether the data browser confirms insertions

If this property is TRUE, the browser confirms insertions, otherwise insertions happen immediately.

Ver también:
confirmCancels() confirmEdits() confirmUpdate() confirmDelete() confirmEdit()
bool QDataBrowser::confirmUpdate [read, write]

whether the browser confirms updates

If this property is TRUE, the browser confirms updates, otherwise updates happen immediately.

Ver también:
confirmCancels() confirmEdits() confirmInsert() confirmDelete() confirmEdit()
QString QDataBrowser::filter [read, write]

the data browser's filter

The filter applies to the data shown in the browser. Call refresh() to apply the new filter. A filter is a string containing a SQL WHERE clause without the WHERE keyword, e.g. "id>1000", "name LIKE 'A%'", etc.

There is no default filter.

Ver también:
sort()
bool QDataBrowser::readOnly [read, write]

whether the browser is read-only

The default is FALSE, i.e. data can be edited. If the data browser is read-only, no database edits will be allowed.

QStringList QDataBrowser::sort [read, write]

the data browser's sort

The data browser's sort affects the order in which records are viewed in the browser. Call refresh() to apply the new sort.

When retrieving the sort property, a string list is returned in the form 'fieldname order', e.g. 'id ASC', 'surname DESC'.

There is no default sort.

Note that if you want to iterate over the list, you should iterate over a copy, e.g.

    QStringList list = myDataBrowser.sort();
    QStringList::Iterator it = list.begin();
    while( it != list.end() ) {
        myProcessing( *it );
        ++it;
    }

La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'