summaryrefslogtreecommitdiffstats
path: root/doc/man/man3/tqdatabrowser.3qt
blob: 76a5b49a69a7bbdbc1ea1a8ac5e5d68dab87a63d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
'\" t
.TH QDataBrowser 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA.  All rights reserved.  See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QDataBrowser \- Data manipulation and navigation for data entry forms
.SH SYNOPSIS
\fC#include <ntqdatabrowser.h>\fR
.PP
Inherits TQWidget.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQDataBrowser\fR ( TQWidget * parent = 0, const char * name = 0, WFlags fl = 0 )"
.br
.ti -1c
.BI "\fB~QDataBrowser\fR ()"
.br
.ti -1c
.BI "enum \fBBoundary\fR { Unknown, None, BeforeBeginning, Beginning, End, AfterEnd }"
.br
.ti -1c
.BI "Boundary \fBboundary\fR ()"
.br
.ti -1c
.BI "void \fBsetBoundaryChecking\fR ( bool active )"
.br
.ti -1c
.BI "bool \fBboundaryChecking\fR () const"
.br
.ti -1c
.BI "void \fBsetSort\fR ( const QSqlIndex & sort )"
.br
.ti -1c
.BI "void \fBsetSort\fR ( const QStringList & sort )"
.br
.ti -1c
.BI "QStringList \fBsort\fR () const"
.br
.ti -1c
.BI "void \fBsetFilter\fR ( const TQString & filter )"
.br
.ti -1c
.BI "TQString \fBfilter\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetSqlCursor\fR ( QSqlCursor * cursor, bool autoDelete = FALSE )"
.br
.ti -1c
.BI "QSqlCursor * \fBsqlCursor\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetForm\fR ( QSqlForm * form )"
.br
.ti -1c
.BI "QSqlForm * \fBform\fR ()"
.br
.ti -1c
.BI "virtual void \fBsetConfirmEdits\fR ( bool confirm )"
.br
.ti -1c
.BI "virtual void \fBsetConfirmInsert\fR ( bool confirm )"
.br
.ti -1c
.BI "virtual void \fBsetConfirmUpdate\fR ( bool confirm )"
.br
.ti -1c
.BI "virtual void \fBsetConfirmDelete\fR ( bool confirm )"
.br
.ti -1c
.BI "virtual void \fBsetConfirmCancels\fR ( bool confirm )"
.br
.ti -1c
.BI "bool \fBconfirmEdits\fR () const"
.br
.ti -1c
.BI "bool \fBconfirmInsert\fR () const"
.br
.ti -1c
.BI "bool \fBconfirmUpdate\fR () const"
.br
.ti -1c
.BI "bool \fBconfirmDelete\fR () const"
.br
.ti -1c
.BI "bool \fBconfirmCancels\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetReadOnly\fR ( bool active )"
.br
.ti -1c
.BI "bool \fBisReadOnly\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetAutoEdit\fR ( bool autoEdit )"
.br
.ti -1c
.BI "bool \fBautoEdit\fR () const"
.br
.ti -1c
.BI "virtual bool \fBseek\fR ( int i, bool relative = FALSE )"
.br
.in -1c
.SS "Public Slots"
.in +1c
.ti -1c
.BI "virtual void \fBrefresh\fR ()"
.br
.ti -1c
.BI "virtual void \fBinsert\fR ()"
.br
.ti -1c
.BI "virtual void \fBupdate\fR ()"
.br
.ti -1c
.BI "virtual void \fBdel\fR ()"
.br
.ti -1c
.BI "virtual void \fBfirst\fR ()"
.br
.ti -1c
.BI "virtual void \fBlast\fR ()"
.br
.ti -1c
.BI "virtual void \fBnext\fR ()"
.br
.ti -1c
.BI "virtual void \fBprev\fR ()"
.br
.ti -1c
.BI "virtual void \fBreadFields\fR ()"
.br
.ti -1c
.BI "virtual void \fBwriteFields\fR ()"
.br
.ti -1c
.BI "virtual void \fBclearValues\fR ()"
.br
.ti -1c
.BI "void \fBupdateBoundary\fR ()"
.br
.in -1c
.SS "Signals"
.in +1c
.ti -1c
.BI "void \fBfirstRecordAvailable\fR ( bool available )"
.br
.ti -1c
.BI "void \fBlastRecordAvailable\fR ( bool available )"
.br
.ti -1c
.BI "void \fBnextRecordAvailable\fR ( bool available )"
.br
.ti -1c
.BI "void \fBprevRecordAvailable\fR ( bool available )"
.br
.ti -1c
.BI "void \fBcurrentChanged\fR ( const QSqlRecord * record )"
.br
.ti -1c
.BI "void \fBprimeInsert\fR ( QSqlRecord * buf )"
.br
.ti -1c
.BI "void \fBprimeUpdate\fR ( QSqlRecord * buf )"
.br
.ti -1c
.BI "void \fBprimeDelete\fR ( QSqlRecord * buf )"
.br
.ti -1c
.BI "void \fBbeforeInsert\fR ( QSqlRecord * buf )"
.br
.ti -1c
.BI "void \fBbeforeUpdate\fR ( QSqlRecord * buf )"
.br
.ti -1c
.BI "void \fBbeforeDelete\fR ( QSqlRecord * buf )"
.br
.ti -1c
.BI "void \fBcursorChanged\fR ( QSqlCursor::Mode mode )"
.br
.in -1c
.SS "Properties"
.in +1c
.ti -1c
.BI "bool \fBautoEdit\fR - whether the browser automatically applies edits"
.br
.ti -1c
.BI "bool \fBboundaryChecking\fR - whether boundary checking is active"
.br
.ti -1c
.BI "bool \fBconfirmCancels\fR - whether the browser confirms cancel operations"
.br
.ti -1c
.BI "bool \fBconfirmDelete\fR - whether the browser confirms deletions"
.br
.ti -1c
.BI "bool \fBconfirmEdits\fR - whether the browser confirms edits"
.br
.ti -1c
.BI "bool \fBconfirmInsert\fR - whether the data browser confirms insertions"
.br
.ti -1c
.BI "bool \fBconfirmUpdate\fR - whether the browser confirms updates"
.br
.ti -1c
.BI "TQString \fBfilter\fR - the data browser's filter"
.br
.ti -1c
.BI "bool \fBreadOnly\fR - whether the browser is read-only"
.br
.ti -1c
.BI "QStringList \fBsort\fR - the data browser's sort"
.br
.in -1c
.SS "Protected Members"
.in +1c
.ti -1c
.BI "virtual bool \fBinsertCurrent\fR ()"
.br
.ti -1c
.BI "virtual bool \fBupdateCurrent\fR ()"
.br
.ti -1c
.BI "virtual bool \fBdeleteCurrent\fR ()"
.br
.ti -1c
.BI "virtual bool \fBcurrentEdited\fR ()"
.br
.ti -1c
.BI "virtual QSql::Confirm \fBconfirmEdit\fR ( QSql::Op m )"
.br
.ti -1c
.BI "virtual QSql::Confirm \fBconfirmCancel\fR ( QSql::Op m )"
.br
.ti -1c
.BI "virtual void \fBhandleError\fR ( const QSqlError & error )"
.br
.in -1c
.SH DESCRIPTION
The QDataBrowser class provides data manipulation and navigation for data entry forms.
.PP
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.
.PP
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.
.PP
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.
.PP
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.
.PP
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.
.PP
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.
.PP
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.
.PP
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:
.TP
\fIinsert\fR 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.
.TP
\fIupdate\fR 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.
.TP
\fIdelete\fR 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.
.PP
See also Database Classes.
.SS "Member Type Documentation"
.SH "QDataBrowser::Boundary"
This enum describes where the data browser is positioned.
.TP
\fCQDataBrowser::Unknown\fR - the boundary cannot be determined (usually because there is no default cursor, or the default cursor is not active).
.TP
\fCQDataBrowser::None\fR - the browser is not positioned on a boundary, but it is positioned on a record somewhere in the middle.
.TP
\fCQDataBrowser::BeforeBeginning\fR - the browser is positioned before the first available record.
.TP
\fCQDataBrowser::Beginning\fR - the browser is positioned at the first record.
.TP
\fCQDataBrowser::End\fR - the browser is positioned at the last record.
.TP
\fCQDataBrowser::AfterEnd\fR - the browser is positioned after the last available record.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QDataBrowser::QDataBrowser ( TQWidget * parent = 0, const char * name = 0, WFlags fl = 0 )"
Constructs a data browser which is a child of \fIparent\fR, with the name \fIname\fR and widget flags set to \fIfl\fR.
.SH "QDataBrowser::~QDataBrowser ()"
Destroys the object and frees any allocated resources.
.SH "bool QDataBrowser::autoEdit () const"
Returns TRUE if the browser automatically applies edits; otherwise returns FALSE. See the "autoEdit" property for details.
.SH "void QDataBrowser::beforeDelete ( QSqlRecord * buf )\fC [signal]\fR"
This signal is emitted just before the cursor's edit buffer is deleted from the database. The \fIbuf\fR parameter points to the edit buffer being deleted. You might connect to this signal to capture some auditing information about the deletion.
.SH "void QDataBrowser::beforeInsert ( QSqlRecord * buf )\fC [signal]\fR"
This signal is emitted just before the cursor's edit buffer is inserted into the database. The \fIbuf\fR parameter points to the edit buffer being inserted. You might connect to this signal to populate a generated primary key for example.
.SH "void QDataBrowser::beforeUpdate ( QSqlRecord * buf )\fC [signal]\fR"
This signal is emitted just before the cursor's edit buffer is updated in the database. The \fIbuf\fR parameter points to the edit buffer being updated. You might connect to this signal to capture some auditing information about the update.
.SH "Boundary QDataBrowser::boundary ()"
Returns an enum indicating the boundary status of the browser.
.PP
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.
.PP
See also Boundary.
.SH "bool QDataBrowser::boundaryChecking () const"
Returns TRUE if boundary checking is active; otherwise returns FALSE. See the "boundaryChecking" property for details.
.SH "void QDataBrowser::clearValues ()\fC [virtual slot]\fR"
Clears all the values in the form.
.PP
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.
.SH "QSql::Confirm QDataBrowser::confirmCancel ( QSql::Op m )\fC [virtual protected]\fR"
Protected virtual function which returns a confirmation for cancelling an edit mode \fIm\fR. 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.
.SH "bool QDataBrowser::confirmCancels () const"
Returns TRUE if the browser confirms cancel operations; otherwise returns FALSE. See the "confirmCancels" property for details.
.SH "bool QDataBrowser::confirmDelete () const"
Returns TRUE if the browser confirms deletions; otherwise returns FALSE. See the "confirmDelete" property for details.
.SH "QSql::Confirm QDataBrowser::confirmEdit ( QSql::Op m )\fC [virtual protected]\fR"
Protected virtual function which returns a confirmation for an edit of mode \fIm\fR. 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.
.SH "bool QDataBrowser::confirmEdits () const"
Returns TRUE if the browser confirms edits; otherwise returns FALSE. See the "confirmEdits" property for details.
.SH "bool QDataBrowser::confirmInsert () const"
Returns TRUE if the data browser confirms insertions; otherwise returns FALSE. See the "confirmInsert" property for details.
.SH "bool QDataBrowser::confirmUpdate () const"
Returns TRUE if the browser confirms updates; otherwise returns FALSE. See the "confirmUpdate" property for details.
.SH "void QDataBrowser::currentChanged ( const QSqlRecord * record )\fC [signal]\fR"
This signal is emitted whenever the current cursor position changes. The \fIrecord\fR parameter points to the contents of the current cursor's record.
.SH "bool QDataBrowser::currentEdited ()\fC [virtual protected]\fR"
Returns TRUE if the form's edit buffer differs from the current cursor buffer; otherwise returns FALSE.
.SH "void QDataBrowser::cursorChanged ( QSqlCursor::Mode mode )\fC [signal]\fR"
This signal is emitted whenever the cursor record was changed due to navigation. The \fImode\fR parameter is the edit that just took place, e.g. Insert, Update or Delete. See QSqlCursor::Mode.
.SH "void QDataBrowser::del ()\fC [virtual slot]\fR"
Performs a delete operation on the data browser's cursor. If there is no default cursor or no default form, nothing happens.
.PP
Otherwise, the following happens:
.PP
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.
.SH "bool QDataBrowser::deleteCurrent ()\fC [virtual protected]\fR"
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.
.PP
See also cursor, form(), and handleError().
.SH "TQString QDataBrowser::filter () const"
Returns the data browser's filter. See the "filter" property for details.
.SH "void QDataBrowser::first ()\fC [virtual slot]\fR"
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.
.PP
If the browser is already positioned on the first record nothing happens.
.SH "void QDataBrowser::firstRecordAvailable ( bool available )\fC [signal]\fR"
This signal is emitted whenever the position of the cursor changes. The \fIavailable\fR parameter indicates whether or not the first record in the default cursor is available.
.SH "QSqlForm * QDataBrowser::form ()"
Returns the data browser's default form or 0 if no form has been set.
.SH "void QDataBrowser::handleError ( const QSqlError & error )\fC [virtual protected]\fR"
Virtual function which handles the error \fIerror\fR. The default implementation warns the user with a message box.
.SH "void QDataBrowser::insert ()\fC [virtual slot]\fR"
Performs an insert operation on the data browser's cursor. If there is no default cursor or no default form, nothing happens.
.PP
If auto-editing is on (see setAutoEdit()), the following happens:
.TP
If the browser is already actively inserting a record, the current form's data is inserted into the database.
.TP
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).
.PP
If there is an error handling any of the above auto-edit actions, handleError() is called and no insert or update is performed.
.PP
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:
.TP
The default cursor is primed for insert using QSqlCursor::primeInsert().
.TP
The primeInsert() signal is emitted.
.TP
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.
.SH "bool QDataBrowser::insertCurrent ()\fC [virtual protected]\fR"
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.
.PP
See also cursorChanged(), sqlCursor(), form(), and handleError().
.SH "bool QDataBrowser::isReadOnly () const"
Returns TRUE if the browser is read-only; otherwise returns FALSE. See the "readOnly" property for details.
.SH "void QDataBrowser::last ()\fC [virtual slot]\fR"
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.
.PP
If the browser is already positioned on the last record nothing happens.
.SH "void QDataBrowser::lastRecordAvailable ( bool available )\fC [signal]\fR"
This signal is emitted whenever the position of the cursor changes. The \fIavailable\fR parameter indicates whether or not the last record in the default cursor is available.
.SH "void QDataBrowser::next ()\fC [virtual slot]\fR"
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.
.PP
If the browser is positioned on the last record nothing happens.
.SH "void QDataBrowser::nextRecordAvailable ( bool available )\fC [signal]\fR"
This signal is emitted whenever the position of the cursor changes. The \fIavailable\fR parameter indicates whether or not the next record in the default cursor is available.
.SH "void QDataBrowser::prev ()\fC [virtual slot]\fR"
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.
.PP
If the browser is positioned on the first record nothing happens.
.SH "void QDataBrowser::prevRecordAvailable ( bool available )\fC [signal]\fR"
This signal is emitted whenever the position of the cursor changes. The \fIavailable\fR parameter indicates whether or not the previous record in the default cursor is available.
.SH "void QDataBrowser::primeDelete ( QSqlRecord * buf )\fC [signal]\fR"
This signal is emitted when the data browser enters deletion mode. The \fIbuf\fR parameter points to the record buffer being deleted. (Note that QSqlCursor::primeDelete() is \fInot\fR 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.
.PP
See also del().
.SH "void QDataBrowser::primeInsert ( QSqlRecord * buf )\fC [signal]\fR"
This signal is emitted when the data browser enters insertion mode. The \fIbuf\fR 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 \fInot\fR called on the default cursor, as this would corrupt values in the form.)
.PP
See also insert().
.SH "void QDataBrowser::primeUpdate ( QSqlRecord * buf )\fC [signal]\fR"
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 \fIbuf\fR parameter points to the record buffer being updated. (Note that QSqlCursor::primeUpdate() is \fInot\fR 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.
.PP
See also update().
.SH "void QDataBrowser::readFields ()\fC [virtual slot]\fR"
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.
.SH "void QDataBrowser::refresh ()\fC [virtual slot]\fR"
Refreshes the data browser's data using the default cursor. The browser's current filter and sort are applied if they have been set.
.PP
See also filter and sort.
.SH "bool QDataBrowser::seek ( int i, bool relative = FALSE )\fC [virtual]\fR"
Moves the default cursor to the record specified by the index \fIi\fR and refreshes the default form to display this record. If there is no default form or no default cursor, nothing happens. If \fIrelative\fR 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.
.PP
If the browser is already positioned on the desired record nothing happens.
.SH "void QDataBrowser::setAutoEdit ( bool autoEdit )\fC [virtual]\fR"
Sets whether the browser automatically applies edits to \fIautoEdit\fR. See the "autoEdit" property for details.
.SH "void QDataBrowser::setBoundaryChecking ( bool active )"
Sets whether boundary checking is active to \fIactive\fR. See the "boundaryChecking" property for details.
.SH "void QDataBrowser::setConfirmCancels ( bool confirm )\fC [virtual]\fR"
Sets whether the browser confirms cancel operations to \fIconfirm\fR. See the "confirmCancels" property for details.
.SH "void QDataBrowser::setConfirmDelete ( bool confirm )\fC [virtual]\fR"
Sets whether the browser confirms deletions to \fIconfirm\fR. See the "confirmDelete" property for details.
.SH "void QDataBrowser::setConfirmEdits ( bool confirm )\fC [virtual]\fR"
Sets whether the browser confirms edits to \fIconfirm\fR. See the "confirmEdits" property for details.
.SH "void QDataBrowser::setConfirmInsert ( bool confirm )\fC [virtual]\fR"
Sets whether the data browser confirms insertions to \fIconfirm\fR. See the "confirmInsert" property for details.
.SH "void QDataBrowser::setConfirmUpdate ( bool confirm )\fC [virtual]\fR"
Sets whether the browser confirms updates to \fIconfirm\fR. See the "confirmUpdate" property for details.
.SH "void QDataBrowser::setFilter ( const TQString & filter )"
Sets the data browser's filter to \fIfilter\fR. See the "filter" property for details.
.SH "void QDataBrowser::setForm ( QSqlForm * form )\fC [virtual]\fR"
Sets the browser's default form to \fIform\fR. The cursor and all navigation and data manipulation functions that the browser provides become available to the \fIform\fR.
.SH "void QDataBrowser::setReadOnly ( bool active )\fC [virtual]\fR"
Sets whether the browser is read-only to \fIactive\fR. See the "readOnly" property for details.
.SH "void QDataBrowser::setSort ( const QStringList & sort )"
Sets the data browser's sort to \fIsort\fR. See the "sort" property for details.
.SH "void QDataBrowser::setSort ( const QSqlIndex & sort )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Sets the data browser's sort to the QSqlIndex \fIsort\fR. To apply the new sort, use refresh().
.SH "void QDataBrowser::setSqlCursor ( QSqlCursor * cursor, bool autoDelete = FALSE )\fC [virtual]\fR"
Sets the default cursor used by the data browser to \fIcursor\fR. If \fIautoDelete\fR is TRUE (the default is FALSE), the data browser takes ownership of the \fIcursor\fR pointer, which will be deleted when the browser is destroyed, or when setSqlCursor() is called again. To activate the \fIcursor\fR use refresh(). The cursor's edit buffer is used in the default form to browse and edit records.
.PP
See also sqlCursor(), form(), and setForm().
.SH "QStringList QDataBrowser::sort () const"
Returns the data browser's sort. See the "sort" property for details.
.SH "QSqlCursor * QDataBrowser::sqlCursor () const"
Returns the default cursor used for navigation, or 0 if there is no default cursor.
.PP
See also setSqlCursor().
.SH "void QDataBrowser::update ()\fC [virtual slot]\fR"
Performs an update operation on the data browser's cursor.
.PP
If there is no default cursor or no default form, nothing happens. Otherwise, the following happens:
.PP
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.
.SH "void QDataBrowser::updateBoundary ()\fC [slot]\fR"
If boundaryChecking() is TRUE, checks the boundary of the current default cursor and emits signals which indicate the position of the cursor.
.SH "bool QDataBrowser::updateCurrent ()\fC [virtual protected]\fR"
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.
.PP
See also cursor, form(), and handleError().
.SH "void QDataBrowser::writeFields ()\fC [virtual slot]\fR"
Writes the form's data to the default cursor's edit buffer. If there is no default cursor or no default form, nothing happens.
.SS "Property Documentation"
.SH "bool autoEdit"
This property holds whether the browser automatically applies edits.
.PP
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:
.TP
the insert or update is is performed -- this occurs if autoEdit is TRUE
.TP
the insert or update is discarded -- this occurs if autoEdit is FALSE
.PP
Set this property's value with setAutoEdit() and get this property's value with autoEdit().
.SH "bool boundaryChecking"
This property holds whether boundary checking is active.
.PP
When boundary checking is active (the default), signals are emitted indicating the current position of the default cursor.
.PP
See also boundary().
.PP
Set this property's value with setBoundaryChecking() and get this property's value with boundaryChecking().
.SH "bool confirmCancels"
This property holds whether the browser confirms cancel operations.
.PP
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.
.PP
See also confirmEdits and confirmCancel().
.PP
Set this property's value with setConfirmCancels() and get this property's value with confirmCancels().
.SH "bool confirmDelete"
This property holds whether the browser confirms deletions.
.PP
If this property is TRUE, the browser confirms deletions, otherwise deletions happen immediately.
.PP
See also confirmCancels, confirmEdits, confirmUpdate, confirmInsert, and confirmEdit().
.PP
Set this property's value with setConfirmDelete() and get this property's value with confirmDelete().
.SH "bool confirmEdits"
This property holds whether the browser confirms edits.
.PP
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,
.PP
See also confirmEdit(), confirmCancels, confirmInsert, confirmUpdate, and confirmDelete.
.PP
Set this property's value with setConfirmEdits() and get this property's value with confirmEdits().
.SH "bool confirmInsert"
This property holds whether the data browser confirms insertions.
.PP
If this property is TRUE, the browser confirms insertions, otherwise insertions happen immediately.
.PP
See also confirmCancels, confirmEdits, confirmUpdate, confirmDelete, and confirmEdit().
.PP
Set this property's value with setConfirmInsert() and get this property's value with confirmInsert().
.SH "bool confirmUpdate"
This property holds whether the browser confirms updates.
.PP
If this property is TRUE, the browser confirms updates, otherwise updates happen immediately.
.PP
See also confirmCancels, confirmEdits, confirmInsert, confirmDelete, and confirmEdit().
.PP
Set this property's value with setConfirmUpdate() and get this property's value with confirmUpdate().
.SH "TQString filter"
This property holds the data browser's filter.
.PP
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.
.PP
There is no default filter.
.PP
See also sort.
.PP
Set this property's value with setFilter() and get this property's value with filter().
.SH "bool readOnly"
This property holds whether the browser is read-only.
.PP
The default is FALSE, i.e. data can be edited. If the data browser is read-only, no database edits will be allowed.
.PP
Set this property's value with setReadOnly() and get this property's value with isReadOnly().
.SH "QStringList sort"
This property holds the data browser's sort.
.PP
The data browser's sort affects the order in which records are viewed in the browser. Call refresh() to apply the new sort.
.PP
When retrieving the sort property, a string list is returned in the form 'fieldname order', e.g. 'id ASC', 'surname DESC'.
.PP
There is no default sort.
.PP
Note that if you want to iterate over the list, you should iterate over a copy, e.g.
.PP
.nf
.br
    QStringList list = myDataBrowser.sort();
.br
    QStringList::Iterator it = list.begin();
.br
    while( it != list.end() ) {
.br
        myProcessing( *it );
.br
        ++it;
.br
    }
.br
.fi
.PP
Set this property's value with setSort() and get this property's value with sort().

.SH "SEE ALSO"
.BR http://doc.trolltech.com/ntqdatabrowser.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive TQt documentation is provided in HTML format; it is
located at $TQTDIR/doc/html and can be read using TQt 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. 
.P
If you find errors in this manual page, please report them to
.BR [email protected] .
Please include the name of the manual page (tqdatabrowser.3qt) and the Qt
version (3.3.8).