summaryrefslogtreecommitdiffstats
path: root/doc/html/tqdatatable.html
blob: 89d010c7fa23eb50dd1ddb6ae3427534402e3001 (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
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/sql/tqdatatable.cpp:130 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQDataTable Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQDataTable Class Reference<br><small>[<a href="sql.html">sql module</a>]</small></h1>

<p>The TQDataTable class provides a flexible SQL table widget that supports browsing and editing.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="tqdatatable-h.html">tqdatatable.h</a>&gt;</tt>
<p>Inherits <a href="ntqtable.html">TQTable</a>.
<p><a href="tqdatatable-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQDataTable"><b>TQDataTable</b></a> ( TQWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn><a href="#TQDataTable-2"><b>TQDataTable</b></a> ( TQSqlCursor&nbsp;*&nbsp;cursor, bool&nbsp;autoPopulate = FALSE, TQWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn><a href="#~TQDataTable"><b>~TQDataTable</b></a> ()</li>
<li class=fn>virtual void <a href="#addColumn"><b>addColumn</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;fieldName, const&nbsp;TQString&nbsp;&amp;&nbsp;label = TQString::null, int&nbsp;width = -1, const&nbsp;TQIconSet&nbsp;&amp;&nbsp;iconset = TQIconSet ( ) )</li>
<li class=fn>virtual void <a href="#removeColumn"><b>removeColumn</b></a> ( uint&nbsp;col )</li>
<li class=fn>virtual void <a href="#setColumn"><b>setColumn</b></a> ( uint&nbsp;col, const&nbsp;TQString&nbsp;&amp;&nbsp;fieldName, const&nbsp;TQString&nbsp;&amp;&nbsp;label = TQString::null, int&nbsp;width = -1, const&nbsp;TQIconSet&nbsp;&amp;&nbsp;iconset = TQIconSet ( ) )</li>
<li class=fn>TQString <a href="#nullText"><b>nullText</b></a> () const</li>
<li class=fn>TQString <a href="#trueText"><b>trueText</b></a> () const</li>
<li class=fn>TQString <a href="#falseText"><b>falseText</b></a> () const</li>
<li class=fn>DateFormat <a href="#dateFormat"><b>dateFormat</b></a> () const</li>
<li class=fn>bool <a href="#confirmEdits"><b>confirmEdits</b></a> () const</li>
<li class=fn>bool <a href="#confirmInsert"><b>confirmInsert</b></a> () const</li>
<li class=fn>bool <a href="#confirmUpdate"><b>confirmUpdate</b></a> () const</li>
<li class=fn>bool <a href="#confirmDelete"><b>confirmDelete</b></a> () const</li>
<li class=fn>bool <a href="#confirmCancels"><b>confirmCancels</b></a> () const</li>
<li class=fn>bool <a href="#autoDelete"><b>autoDelete</b></a> () const</li>
<li class=fn>bool <a href="#autoEdit"><b>autoEdit</b></a> () const</li>
<li class=fn>TQString <a href="#filter"><b>filter</b></a> () const</li>
<li class=fn>TQStringList <a href="#sort"><b>sort</b></a> () const</li>
<li class=fn>virtual void <a href="#setSqlCursor"><b>setSqlCursor</b></a> ( TQSqlCursor&nbsp;*&nbsp;cursor = 0, bool&nbsp;autoPopulate = FALSE, bool&nbsp;autoDelete = FALSE )</li>
<li class=fn>TQSqlCursor * <a href="#sqlCursor"><b>sqlCursor</b></a> () const</li>
<li class=fn>virtual void <a href="#setNullText"><b>setNullText</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;nullText )</li>
<li class=fn>virtual void <a href="#setTrueText"><b>setTrueText</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;trueText )</li>
<li class=fn>virtual void <a href="#setFalseText"><b>setFalseText</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;falseText )</li>
<li class=fn>virtual void <a href="#setDateFormat"><b>setDateFormat</b></a> ( const&nbsp;DateFormat&nbsp;f )</li>
<li class=fn>virtual void <a href="#setConfirmEdits"><b>setConfirmEdits</b></a> ( bool&nbsp;confirm )</li>
<li class=fn>virtual void <a href="#setConfirmInsert"><b>setConfirmInsert</b></a> ( bool&nbsp;confirm )</li>
<li class=fn>virtual void <a href="#setConfirmUpdate"><b>setConfirmUpdate</b></a> ( bool&nbsp;confirm )</li>
<li class=fn>virtual void <a href="#setConfirmDelete"><b>setConfirmDelete</b></a> ( bool&nbsp;confirm )</li>
<li class=fn>virtual void <a href="#setConfirmCancels"><b>setConfirmCancels</b></a> ( bool&nbsp;confirm )</li>
<li class=fn>virtual void <a href="#setAutoDelete"><b>setAutoDelete</b></a> ( bool&nbsp;enable )</li>
<li class=fn>virtual void <a href="#setAutoEdit"><b>setAutoEdit</b></a> ( bool&nbsp;autoEdit )</li>
<li class=fn>virtual void <a href="#setFilter"><b>setFilter</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;filter )</li>
<li class=fn>virtual void <a href="#setSort"><b>setSort</b></a> ( const&nbsp;TQStringList&nbsp;&amp;&nbsp;sort )</li>
<li class=fn>virtual void <a href="#setSort-2"><b>setSort</b></a> ( const&nbsp;TQSqlIndex&nbsp;&amp;&nbsp;sort )</li>
<li class=fn>enum <a href="#Refresh-enum"><b>Refresh</b></a> { RefreshData = 1, RefreshColumns = 2, RefreshAll = 3 }</li>
<li class=fn>void <a href="#refresh-2"><b>refresh</b></a> ( Refresh&nbsp;mode )</li>
<li class=fn>virtual void <a href="#sortColumn"><b>sortColumn</b></a> ( int&nbsp;col, bool&nbsp;ascending = TRUE, bool&nbsp;wholeRows = FALSE )</li>
<li class=fn>virtual TQString <a href="#text"><b>text</b></a> ( int&nbsp;row, int&nbsp;col ) const</li>
<li class=fn>TQVariant <a href="#value"><b>value</b></a> ( int&nbsp;row, int&nbsp;col ) const</li>
<li class=fn>TQSqlRecord * <a href="#currentRecord"><b>currentRecord</b></a> () const</li>
<li class=fn>void <a href="#installEditorFactory"><b>installEditorFactory</b></a> ( TQSqlEditorFactory&nbsp;*&nbsp;f )</li>
<li class=fn>void <a href="#installPropertyMap"><b>installPropertyMap</b></a> ( TQSqlPropertyMap&nbsp;*&nbsp;m )</li>
<li class=fn>virtual int <a href="#numCols"><b>numCols</b></a> () const</li>
<li class=fn>virtual int <a href="#numRows"><b>numRows</b></a> () const</li>
</ul>
<h2>Public Slots</h2>
<ul>
<li class=fn>virtual void <a href="#find"><b>find</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;str, bool&nbsp;caseSensitive, bool&nbsp;backwards )</li>
<li class=fn>virtual void <a href="#sortAscending"><b>sortAscending</b></a> ( int&nbsp;col )</li>
<li class=fn>virtual void <a href="#sortDescending"><b>sortDescending</b></a> ( int&nbsp;col )</li>
<li class=fn>virtual void <a href="#refresh"><b>refresh</b></a> ()</li>
<li class=fn>virtual void <a href="#setColumnWidth"><b>setColumnWidth</b></a> ( int&nbsp;col, int&nbsp;w )</li>
<li class=fn>virtual void <a href="#adjustColumn"><b>adjustColumn</b></a> ( int&nbsp;col )</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#currentChanged"><b>currentChanged</b></a> ( TQSqlRecord&nbsp;*&nbsp;record )</li>
<li class=fn>void <a href="#primeInsert"><b>primeInsert</b></a> ( TQSqlRecord&nbsp;*&nbsp;buf )</li>
<li class=fn>void <a href="#primeUpdate"><b>primeUpdate</b></a> ( TQSqlRecord&nbsp;*&nbsp;buf )</li>
<li class=fn>void <a href="#primeDelete"><b>primeDelete</b></a> ( TQSqlRecord&nbsp;*&nbsp;buf )</li>
<li class=fn>void <a href="#beforeInsert"><b>beforeInsert</b></a> ( TQSqlRecord&nbsp;*&nbsp;buf )</li>
<li class=fn>void <a href="#beforeUpdate"><b>beforeUpdate</b></a> ( TQSqlRecord&nbsp;*&nbsp;buf )</li>
<li class=fn>void <a href="#beforeDelete"><b>beforeDelete</b></a> ( TQSqlRecord&nbsp;*&nbsp;buf )</li>
<li class=fn>void <a href="#cursorChanged"><b>cursorChanged</b></a> ( TQSql::Op&nbsp;mode )</li>
</ul>
<h2>Properties</h2>
<ul>
<li class=fn>bool <a href="#autoEdit-prop"><b>autoEdit</b></a>&nbsp;- whether the data table automatically applies edits</li>
<li class=fn>bool <a href="#confirmCancels-prop"><b>confirmCancels</b></a>&nbsp;- whether the data table confirms cancel operations</li>
<li class=fn>bool <a href="#confirmDelete-prop"><b>confirmDelete</b></a>&nbsp;- whether the data table confirms delete operations</li>
<li class=fn>bool <a href="#confirmEdits-prop"><b>confirmEdits</b></a>&nbsp;- whether the data table confirms edit operations</li>
<li class=fn>bool <a href="#confirmInsert-prop"><b>confirmInsert</b></a>&nbsp;- whether the data table confirms insert operations</li>
<li class=fn>bool <a href="#confirmUpdate-prop"><b>confirmUpdate</b></a>&nbsp;- whether the data table confirms update operations</li>
<li class=fn>DateFormat <a href="#dateFormat-prop"><b>dateFormat</b></a>&nbsp;- the format used for displaying date/time values</li>
<li class=fn>TQString <a href="#falseText-prop"><b>falseText</b></a>&nbsp;- the text used to represent false values</li>
<li class=fn>TQString <a href="#filter-prop"><b>filter</b></a>&nbsp;- the data filter for the data table</li>
<li class=fn>TQString <a href="#nullText-prop"><b>nullText</b></a>&nbsp;- the text used to represent NULL values</li>
<li class=fn>int <a href="#numCols-prop"><b>numCols</b></a>&nbsp;- the number of columns in the table &nbsp;<em>(read only)</em></li>
<li class=fn>int <a href="#numRows-prop"><b>numRows</b></a>&nbsp;- the number of rows in the table &nbsp;<em>(read only)</em></li>
<li class=fn>TQStringList <a href="#sort-prop"><b>sort</b></a>&nbsp;- the data table's sort</li>
<li class=fn>TQString <a href="#trueText-prop"><b>trueText</b></a>&nbsp;- the text used to represent true values</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>virtual bool <a href="#insertCurrent"><b>insertCurrent</b></a> ()</li>
<li class=fn>virtual bool <a href="#updateCurrent"><b>updateCurrent</b></a> ()</li>
<li class=fn>virtual bool <a href="#deleteCurrent"><b>deleteCurrent</b></a> ()</li>
<li class=fn>virtual TQSql::Confirm <a href="#confirmEdit"><b>confirmEdit</b></a> ( TQSql::Op&nbsp;m )</li>
<li class=fn>virtual TQSql::Confirm <a href="#confirmCancel"><b>confirmCancel</b></a> ( TQSql::Op&nbsp;m )</li>
<li class=fn>virtual void <a href="#handleError"><b>handleError</b></a> ( const&nbsp;TQSqlError&nbsp;&amp;&nbsp;e )</li>
<li class=fn>virtual bool <a href="#beginInsert"><b>beginInsert</b></a> ()</li>
<li class=fn>virtual TQWidget * <a href="#beginUpdate"><b>beginUpdate</b></a> ( int&nbsp;row, int&nbsp;col, bool&nbsp;replace )</li>
<li class=fn>int <a href="#indexOf"><b>indexOf</b></a> ( uint&nbsp;i ) const</li>
<li class=fn>void <a href="#reset"><b>reset</b></a> ()</li>
<li class=fn>void <a href="#setSize"><b>setSize</b></a> ( TQSqlCursor&nbsp;*&nbsp;sql )</li>
<li class=fn>virtual void <a href="#paintField"><b>paintField</b></a> ( TQPainter&nbsp;*&nbsp;p, const&nbsp;TQSqlField&nbsp;*&nbsp;field, const&nbsp;TQRect&nbsp;&amp;&nbsp;cr, bool&nbsp;selected )</li>
<li class=fn>virtual int <a href="#fieldAlignment"><b>fieldAlignment</b></a> ( const&nbsp;TQSqlField&nbsp;*&nbsp;field )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The TQDataTable class provides a flexible SQL table widget that supports browsing and editing.
<p> 


<p> TQDataTable supports various functions for presenting and editing
SQL data from a <a href="tqsqlcursor.html">TQSqlCursor</a> in a table.
<p> If you want a to present your data in a form use <a href="tqdatabrowser.html">TQDataBrowser</a>, or
for read-only forms, <a href="tqdataview.html">TQDataView</a>.
<p> When displaying data, TQDataTable only retrieves data for visible
rows. If the driver supports the 'query size' property the
TQDataTable will have the correct number of rows and the vertical
scrollbar will accurately reflect the number of rows displayed in
proportion to the number of rows in the dataset. If the driver
does not support the 'query size' property, rows are dynamically
fetched from the database on an as-needed basis with the scrollbar
becoming more accurate as the user scrolls down through the
records. This allows extremely large queries to be displayed as
quickly as possible, with minimum memory usage.
<p> TQDataTable inherits <a href="ntqtable.html">TQTable</a>'s API and extends it with functions to
sort and filter the data and sort columns. See <a href="#setSqlCursor">setSqlCursor</a>(),
<a href="#setFilter">setFilter</a>(), <a href="#setSort">setSort</a>(), <a href="ntqtable.html#setSorting">setSorting</a>(), <a href="#sortColumn">sortColumn</a>() and <a href="#refresh">refresh</a>().
<p> When displaying editable cursors, cell editing will be enabled.
(For more information on editable cursors, see <a href="tqsqlcursor.html">TQSqlCursor</a>).
TQDataTable can be used to modify existing data and to add new
records. When a user makes changes to a field in the table, the
cursor's edit buffer is used. The table will not send changes in
the edit buffer to the database until the user moves to a
different record in the grid or presses Enter. Cell editing is
initiated by pressing F2 (or right clicking and then clicking the
appropriate popup menu item) and canceled by pressing Esc. If
there is a problem updating or adding data, errors are handled
automatically (see <a href="#handleError">handleError</a>() to change this behavior). Note
that if <a href="#autoEdit">autoEdit</a>() is FALSE navigating to another record will
cancel the insert or update.
<p> The user can be asked to confirm all edits with <a href="#setConfirmEdits">setConfirmEdits</a>().
For more precise control use <a href="#setConfirmInsert">setConfirmInsert</a>(),
<a href="#setConfirmUpdate">setConfirmUpdate</a>(), <a href="#setConfirmDelete">setConfirmDelete</a>() and <a href="#setConfirmCancels">setConfirmCancels</a>().
Use <a href="#setAutoEdit">setAutoEdit</a>() to control the behaviour of the table when the
user edits a record and then navigates. (Note that <a href="#setAutoDelete">setAutoDelete</a>()
is unrelated; it is used to set whether the <a href="tqsqlcursor.html">TQSqlCursor</a> is deleted
when the table is deleted.)
<p> Since the data table can perform edits, it must be able to
uniquely identify every record so that edits are correctly
applied. Because of this the underlying cursor must have a valid
primary index to ensure that a unique record is inserted, updated
or deleted within the database otherwise the database may be
changed to an inconsistent state.
<p> TQDataTable creates editors using the default <a href="tqsqleditorfactory.html">TQSqlEditorFactory</a>.
Different editor factories can be used by calling
<a href="#installEditorFactory">installEditorFactory</a>(). A property map is used to map between the
cell's value and the editor. You can use your own property map
with <a href="#installPropertyMap">installPropertyMap</a>().
<p> The contents of a cell is available as a <a href="tqstring.html">TQString</a> with <a href="#text">text</a>() or as
a <a href="ntqvariant.html">TQVariant</a> with <a href="#value">value</a>(). The current record is returned by
<a href="#currentRecord">currentRecord</a>(). Use the <a href="#find">find</a>() function to search for a string in
the table.
<p> Editing actions can be applied programatically. For example, the
<a href="#insertCurrent">insertCurrent</a>() function reads the fields from the current record
into the cursor and performs the insert. The <a href="#updateCurrent">updateCurrent</a>() and
<a href="#deleteCurrent">deleteCurrent</a>() functions perform similarly to update and delete
the current record respectively.
<p> Columns in the table can be created automatically based on the
cursor (see <a href="#setSqlCursor">setSqlCursor</a>()). Columns can be manipulated manually
using <a href="#addColumn">addColumn</a>(), <a href="#removeColumn">removeColumn</a>() and <a href="#setColumn">setColumn</a>().
<p> The table automatically copies many of the properties of the
cursor to format the display of data within cells (alignment,
visibility, etc.). The cursor can be changed with setSqlCursor().
The filter (see <a href="#setFilter">setFilter</a>()) and sort defined within the table are
used instead of the filter and sort set on the cursor. For sorting
options see <a href="#setSort">setSort</a>(), <a href="#sortColumn">sortColumn</a>(), <a href="#sortAscending">sortAscending</a>() and
<a href="#sortDescending">sortDescending</a>(). Note that sorting operations will not behave as
expected if you are using a <a href="tqsqlselectcursor.html">TQSqlSelectCursor</a> because it uses
user-defined SQL queries to obtain data.
<p> The text used to represent NULL, TRUE and FALSE values can be
changed with <a href="#setNullText">setNullText</a>(), <a href="#setTrueText">setTrueText</a>() and <a href="#setFalseText">setFalseText</a>()
respectively. You can change the appearance of cells by
reimplementing <a href="#paintField">paintField</a>().
<p> Whenever a new row is selected in the table the <a href="#currentChanged">currentChanged</a>()
signal is emitted. The <a href="#primeInsert">primeInsert</a>() signal is emitted when an
insert is initiated. The <a href="#primeUpdate">primeUpdate</a>() and <a href="#primeDelete">primeDelete</a>() signals
are emitted when update and deletion are initiated respectively.
Just before the database is updated a signal is emitted;
<a href="#beforeInsert">beforeInsert</a>(), <a href="#beforeUpdate">beforeUpdate</a>() or <a href="#beforeDelete">beforeDelete</a>() as appropriate.
<p> <p>See also <a href="database.html">Database Classes</a>.

<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="Refresh-enum"></a>TQDataTable::Refresh</h3>

<p> This enum describes the refresh options.
<ul>
<li><tt>TQDataTable::RefreshData</tt> - refresh the data, i.e. read it from the database
<li><tt>TQDataTable::RefreshColumns</tt> - refresh the list of fields, e.g. the column headings
<li><tt>TQDataTable::RefreshAll</tt> - refresh both the data and the list of fields
</ul>
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQDataTable"></a>TQDataTable::TQDataTable ( <a href="tqwidget.html">TQWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs a data table which is a child of <em>parent</em>, called
name <em>name</em>.

<h3 class=fn><a name="TQDataTable-2"></a>TQDataTable::TQDataTable ( <a href="tqsqlcursor.html">TQSqlCursor</a>&nbsp;*&nbsp;cursor, bool&nbsp;autoPopulate = FALSE, <a href="tqwidget.html">TQWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs a data table which is a child of <em>parent</em>, called name
<em>name</em> using the cursor <em>cursor</em>.
<p> If <em>autoPopulate</em> is TRUE (the default is FALSE), columns are
automatically created based upon the fields in the <em>cursor</em>
record. Note that <em>autoPopulate</em> only governs the creation of
columns; to load the cursor's data into the table use <a href="#refresh">refresh</a>().
<p> If the <em>cursor</em> is read-only, the table also becomes read-only.
In addition, the table adopts the cursor's driver's definition for
representing NULL values as strings.

<h3 class=fn><a name="~TQDataTable"></a>TQDataTable::~TQDataTable ()
</h3>
Destroys the object and frees any allocated resources.

<h3 class=fn>void <a name="addColumn"></a>TQDataTable::addColumn ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;fieldName, const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;label = TQString::null, int&nbsp;width = -1, const&nbsp;<a href="tqiconset.html">TQIconSet</a>&nbsp;&amp;&nbsp;iconset = TQIconSet ( ) )<tt> [virtual]</tt>
</h3>
Adds the next column to be displayed using the field <em>fieldName</em>,
column label <em>label</em>, width <em>width</em> and iconset <em>iconset</em>.
<p> If <em>label</em> is specified, it is used as the column's header label,
otherwise the field's display label is used when <a href="#setSqlCursor">setSqlCursor</a>() is
called. The <em>iconset</em> is used to set the icon used by the column
header; by default there is no icon.
<p> <p>See also <a href="#setSqlCursor">setSqlCursor</a>() and <a href="#refresh">refresh</a>().

<p>Examples: <a href="sql.html#x2255">sql/overview/subclass1/main.cpp</a>, <a href="sql.html#x2258">sql/overview/subclass3/main.cpp</a>, <a href="sql.html#x2214">sql/overview/table2/main.cpp</a>, and <a href="sqltable-example.html#x2451">sql/sqltable/main.cpp</a>.
<h3 class=fn>void <a name="adjustColumn"></a>TQDataTable::adjustColumn ( int&nbsp;col )<tt> [virtual slot]</tt>
</h3>
Resizes column <em>col</em> so that the column width is wide enough to
display the widest item the column contains (including the column
label). If the table's <a href="tqsqlcursor.html">TQSqlCursor</a> is not currently active, the
cursor will be refreshed before the column width is calculated. Be
aware that this function may be slow on tables that contain large
result sets.

<p>Reimplemented from <a href="ntqtable.html#adjustColumn">TQTable</a>.
<h3 class=fn>bool <a name="autoDelete"></a>TQDataTable::autoDelete () const
</h3>
Returns TRUE if the table will automatically delete the cursor
specified by <a href="#setSqlCursor">setSqlCursor</a>(); otherwise returns FALSE.

<h3 class=fn>bool <a name="autoEdit"></a>TQDataTable::autoEdit () const
</h3><p>Returns TRUE if the data table automatically applies edits; otherwise returns FALSE.
See the <a href="tqdatatable.html#autoEdit-prop">"autoEdit"</a> property for details.
<h3 class=fn>void <a name="beforeDelete"></a>TQDataTable::beforeDelete ( <a href="tqsqlrecord.html">TQSqlRecord</a>&nbsp;*&nbsp;buf )<tt> [signal]</tt>
</h3>

<p> This signal is emitted just before the currently selected record
is deleted from the database. The <em>buf</em> parameter points to the
edit buffer being deleted. Connect to this signal to, for example,
copy some of the fields for later use.

<h3 class=fn>void <a name="beforeInsert"></a>TQDataTable::beforeInsert ( <a href="tqsqlrecord.html">TQSqlRecord</a>&nbsp;*&nbsp;buf )<tt> [signal]</tt>
</h3>

<p> This signal is emitted just before the cursor's edit buffer is
inserted into the database. The <em>buf</em> parameter points to the
edit buffer being inserted. Connect to this signal to, for
example, populate a key field with a unique sequence number.

<h3 class=fn>void <a name="beforeUpdate"></a>TQDataTable::beforeUpdate ( <a href="tqsqlrecord.html">TQSqlRecord</a>&nbsp;*&nbsp;buf )<tt> [signal]</tt>
</h3>

<p> This signal is emitted just before the cursor's edit buffer is
updated in the database. The <em>buf</em> parameter points to the edit
buffer being updated. Connect to this signal when you want to
transform the user's data behind-the-scenes.

<h3 class=fn>bool <a name="beginInsert"></a>TQDataTable::beginInsert ()<tt> [virtual protected]</tt>
</h3>
Protected virtual function called when editing is about to begin
on a new record. If the table is read-only, or if there's no
cursor or the cursor does not allow inserts, nothing happens.
<p> Editing takes place using the cursor's edit buffer(see
<a href="tqsqlcursor.html#editBuffer">TQSqlCursor::editBuffer</a>()).
<p> When editing begins, a new row is created in the table marked with
an asterisk '*' in the row's vertical header column, i.e. at the
left of the row.

<h3 class=fn><a href="tqwidget.html">TQWidget</a>&nbsp;* <a name="beginUpdate"></a>TQDataTable::beginUpdate ( int&nbsp;row, int&nbsp;col, bool&nbsp;replace )<tt> [virtual protected]</tt>
</h3>
Protected virtual function called when editing is about to begin
on an existing row. If the table is read-only, or if there's no
cursor, nothing happens.
<p> Editing takes place using the cursor's edit buffer (see
<a href="tqsqlcursor.html#editBuffer">TQSqlCursor::editBuffer</a>()).
<p> <em>row</em> and <em>col</em> refer to the row and column in the TQDataTable.
<p> (<em>replace</em> is provided for reimplementors and reflects the API of
<a href="ntqtable.html#beginEdit">TQTable::beginEdit</a>().)

<h3 class=fn><a href="tqsql.html#Confirm-enum">TQSql::Confirm</a> <a name="confirmCancel"></a>TQDataTable::confirmCancel ( <a href="tqsql.html#Op-enum">TQSql::Op</a>&nbsp;m )<tt> [virtual protected]</tt>
</h3>
Protected virtual function which returns a confirmation for
cancelling an edit mode of <em>m</em>. Derived classes can reimplement
this function to provide their own cancel dialog. The default
implementation uses a message box which prompts the user to
confirm the cancel.

<h3 class=fn>bool <a name="confirmCancels"></a>TQDataTable::confirmCancels () const
</h3><p>Returns TRUE if the data table confirms cancel operations; otherwise returns FALSE.
See the <a href="tqdatatable.html#confirmCancels-prop">"confirmCancels"</a> property for details.
<h3 class=fn>bool <a name="confirmDelete"></a>TQDataTable::confirmDelete () const
</h3><p>Returns TRUE if the data table confirms delete operations; otherwise returns FALSE.
See the <a href="tqdatatable.html#confirmDelete-prop">"confirmDelete"</a> property for details.
<h3 class=fn><a href="tqsql.html#Confirm-enum">TQSql::Confirm</a> <a name="confirmEdit"></a>TQDataTable::confirmEdit ( <a href="tqsql.html#Op-enum">TQSql::Op</a>&nbsp;m )<tt> [virtual protected]</tt>
</h3>
Protected virtual function which returns a confirmation for an
edit of mode <em>m</em>. Derived classes can reimplement this function
to provide their own confirmation dialog. The default
implementation uses a message box which prompts the user to
confirm the edit action.

<h3 class=fn>bool <a name="confirmEdits"></a>TQDataTable::confirmEdits () const
</h3><p>Returns TRUE if the data table confirms edit operations; otherwise returns FALSE.
See the <a href="tqdatatable.html#confirmEdits-prop">"confirmEdits"</a> property for details.
<h3 class=fn>bool <a name="confirmInsert"></a>TQDataTable::confirmInsert () const
</h3><p>Returns TRUE if the data table confirms insert operations; otherwise returns FALSE.
See the <a href="tqdatatable.html#confirmInsert-prop">"confirmInsert"</a> property for details.
<h3 class=fn>bool <a name="confirmUpdate"></a>TQDataTable::confirmUpdate () const
</h3><p>Returns TRUE if the data table confirms update operations; otherwise returns FALSE.
See the <a href="tqdatatable.html#confirmUpdate-prop">"confirmUpdate"</a> property for details.
<h3 class=fn>void <a name="currentChanged"></a>TQDataTable::currentChanged ( <a href="tqsqlrecord.html">TQSqlRecord</a>&nbsp;*&nbsp;record )<tt> [signal]</tt>
</h3>

<p> This signal is emitted whenever a new row is selected in the
table. The <em>record</em> parameter points to the contents of the newly
selected record.

<h3 class=fn><a href="tqsqlrecord.html">TQSqlRecord</a>&nbsp;* <a name="currentRecord"></a>TQDataTable::currentRecord () const
</h3>
Returns the currently selected record, or 0 if there is no current
selection. The table owns the pointer, so do <em>not</em> delete it or
otherwise modify it or the cursor it points to.

<h3 class=fn>void <a name="cursorChanged"></a>TQDataTable::cursorChanged ( <a href="tqsql.html#Op-enum">TQSql::Op</a>&nbsp;mode )<tt> [signal]</tt>
</h3>

<p> This signal is emitted whenever the cursor record was changed due
to an edit. The <em>mode</em> parameter is the type of edit that just
took place.

<h3 class=fn><a href="ntqt.html#DateFormat-enum">DateFormat</a> <a name="dateFormat"></a>TQDataTable::dateFormat () const
</h3><p>Returns the format used for displaying date/time values.
See the <a href="tqdatatable.html#dateFormat-prop">"dateFormat"</a> property for details.
<h3 class=fn>bool <a name="deleteCurrent"></a>TQDataTable::deleteCurrent ()<tt> [virtual protected]</tt>
</h3>
For an editable table, issues a delete on the current cursor's
primary index using the values of the currently selected row. If
there is no current cursor or there is no current selection,
nothing happens. If <a href="#confirmEdits">confirmEdits</a>() or <a href="#confirmDelete">confirmDelete</a>() is TRUE,
<a href="#confirmEdit">confirmEdit</a>() is called to confirm the delete. Returns TRUE if the
delete succeeded; otherwise FALSE.
<p> The underlying cursor must have a valid primary index to ensure
that a unique record is deleted within the database otherwise the
database may be changed to an inconsistent state.

<h3 class=fn><a href="tqstring.html">TQString</a> <a name="falseText"></a>TQDataTable::falseText () const
</h3><p>Returns the text used to represent false values.
See the <a href="tqdatatable.html#falseText-prop">"falseText"</a> property for details.
<h3 class=fn>int <a name="fieldAlignment"></a>TQDataTable::fieldAlignment ( const&nbsp;<a href="tqsqlfield.html">TQSqlField</a>&nbsp;*&nbsp;field )<tt> [virtual protected]</tt>
</h3>
Returns the alignment for <em>field</em>.

<h3 class=fn><a href="tqstring.html">TQString</a> <a name="filter"></a>TQDataTable::filter () const
</h3><p>Returns the data filter for the data table.
See the <a href="tqdatatable.html#filter-prop">"filter"</a> property for details.
<h3 class=fn>void <a name="find"></a>TQDataTable::find ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;str, bool&nbsp;caseSensitive, bool&nbsp;backwards )<tt> [virtual slot]</tt>
</h3>
Searches the current cursor for a cell containing the string <em>str</em> starting at the current cell and working forwards (or
backwards if <em>backwards</em> is TRUE). If the string is found, the
cell containing the string is set as the current cell. If <em>caseSensitive</em> is FALSE the case of <em>str</em> will be ignored.
<p> The search will wrap, i.e. if the first (or if backwards is TRUE,
last) cell is reached without finding <em>str</em> the search will
continue until it reaches the starting cell. If <em>str</em> is not
found the search will fail and the current cell will remain
unchanged.

<h3 class=fn>void <a name="handleError"></a>TQDataTable::handleError ( const&nbsp;<a href="tqsqlerror.html">TQSqlError</a>&nbsp;&amp;&nbsp;e )<tt> [virtual protected]</tt>
</h3>
Protected virtual function which is called when an error <em>e</em> has
occurred on the current <a href="tqwidget.html#cursor">cursor</a>(). The default implementation
displays a warning message to the user with information about the
error.

<h3 class=fn>int <a name="indexOf"></a>TQDataTable::indexOf ( uint&nbsp;i ) const<tt> [protected]</tt>
</h3>
Returns the index of the field within the current SQL query that
is displayed in column <em>i</em>.

<h3 class=fn>bool <a name="insertCurrent"></a>TQDataTable::insertCurrent ()<tt> [virtual protected]</tt>
</h3>
For an editable table, issues an insert on the current cursor
using the values in the cursor's edit buffer. If there is no
current cursor or there is no current "insert" row, nothing
happens. If <a href="#confirmEdits">confirmEdits</a>() or <a href="#confirmInsert">confirmInsert</a>() is TRUE,
<a href="#confirmEdit">confirmEdit</a>() is called to confirm the insert. Returns TRUE if the
insert succeeded; otherwise returns FALSE.
<p> The underlying cursor must have a valid primary index to ensure
that a unique record is inserted within the database otherwise the
database may be changed to an inconsistent state.

<h3 class=fn>void <a name="installEditorFactory"></a>TQDataTable::installEditorFactory ( <a href="tqsqleditorfactory.html">TQSqlEditorFactory</a>&nbsp;*&nbsp;f )
</h3>
Installs a new SQL editor factory <em>f</em>. This enables the user to
create and instantiate their own editors for use in cell editing.
Note that TQDataTable takes ownership of this pointer, and will
delete it when it is no longer needed or when
<a href="#installEditorFactory">installEditorFactory</a>() is called again.
<p> <p>See also <a href="tqsqleditorfactory.html">TQSqlEditorFactory</a>.

<h3 class=fn>void <a name="installPropertyMap"></a>TQDataTable::installPropertyMap ( <a href="tqsqlpropertymap.html">TQSqlPropertyMap</a>&nbsp;*&nbsp;m )
</h3>
Installs a new property map <em>m</em>. This enables the user to create
and instantiate their own property maps for use in cell editing.
Note that TQDataTable takes ownership of this pointer, and will
delete it when it is no longer needed or when installPropertMap()
is called again.
<p> <p>See also <a href="tqsqlpropertymap.html">TQSqlPropertyMap</a>.

<h3 class=fn><a href="tqstring.html">TQString</a> <a name="nullText"></a>TQDataTable::nullText () const
</h3><p>Returns the text used to represent NULL values.
See the <a href="tqdatatable.html#nullText-prop">"nullText"</a> property for details.
<h3 class=fn>int <a name="numCols"></a>TQDataTable::numCols () const<tt> [virtual]</tt>
</h3><p>Returns the number of columns in the table.
See the <a href="tqdatatable.html#numCols-prop">"numCols"</a> property for details.
<p>Reimplemented from <a href="ntqtable.html#numCols">TQTable</a>.
<h3 class=fn>int <a name="numRows"></a>TQDataTable::numRows () const<tt> [virtual]</tt>
</h3><p>Returns the number of rows in the table.
See the <a href="tqdatatable.html#numRows-prop">"numRows"</a> property for details.
<p>Reimplemented from <a href="ntqtable.html#numRows">TQTable</a>.
<h3 class=fn>void <a name="paintField"></a>TQDataTable::paintField ( <a href="ntqpainter.html">TQPainter</a>&nbsp;*&nbsp;p, const&nbsp;<a href="tqsqlfield.html">TQSqlField</a>&nbsp;*&nbsp;field, const&nbsp;<a href="ntqrect.html">TQRect</a>&nbsp;&amp;&nbsp;cr, bool&nbsp;selected )<tt> [virtual protected]</tt>
</h3>
Paints the <em>field</em> on the painter <em>p</em>. The painter has already
been translated to the appropriate cell's origin where the <em>field</em> is to be rendered. <em>cr</em> describes the cell coordinates in
the content coordinate system. The <em>selected</em> parameter is
ignored.
<p> If you want to draw custom field content you must reimplement
<a href="#paintField">paintField</a>() to do the custom drawing. The default implementation
renders the <em>field</em> value as text. If the field is NULL,
<a href="#nullText">nullText</a>() is displayed in the cell. If the field is Boolean,
<a href="#trueText">trueText</a>() or <a href="#falseText">falseText</a>() is displayed as appropriate.

<p>Example: <a href="sql.html#x2245">sql/overview/table4/main.cpp</a>.
<h3 class=fn>void <a name="primeDelete"></a>TQDataTable::primeDelete ( <a href="tqsqlrecord.html">TQSqlRecord</a>&nbsp;*&nbsp;buf )<tt> [signal]</tt>
</h3>

<p> This signal is emitted after the cursor is primed for delete by
the table, when a delete action is beginning on the table. The <em>buf</em> parameter points to the edit buffer being deleted. Connect to
this signal in order to, for example, record auditing information
on deletions.

<h3 class=fn>void <a name="primeInsert"></a>TQDataTable::primeInsert ( <a href="tqsqlrecord.html">TQSqlRecord</a>&nbsp;*&nbsp;buf )<tt> [signal]</tt>
</h3>

<p> This signal is emitted after the cursor is primed for insert by
the table, when an insert action is beginning on the table. The <em>buf</em> parameter points to the edit buffer being inserted. Connect to
this signal in order to, for example, <a href="primes.html#prime">prime</a> the record buffer with
default data values.

<h3 class=fn>void <a name="primeUpdate"></a>TQDataTable::primeUpdate ( <a href="tqsqlrecord.html">TQSqlRecord</a>&nbsp;*&nbsp;buf )<tt> [signal]</tt>
</h3>

<p> This signal is emitted after the cursor is primed for update by
the table, when an update action is beginning on the table. The <em>buf</em> parameter points to the edit buffer being updated. Connect to
this signal in order to, for example, provide some visual feedback
that the user is in 'edit mode'.

<h3 class=fn>void <a name="refresh"></a>TQDataTable::refresh ()<tt> [virtual slot]</tt>
</h3>
Refreshes the table. The cursor is refreshed using the current
filter, the current sort, and the currently defined columns.
Equivalent to calling <a href="#refresh">refresh</a>( TQDataTable::RefreshData ).

<p>Examples: <a href="sql.html#x2256">sql/overview/subclass1/main.cpp</a>, <a href="sql.html#x2211">sql/overview/table1/main.cpp</a>, <a href="sql.html#x2215">sql/overview/table2/main.cpp</a>, and <a href="sqltable-example.html#x2452">sql/sqltable/main.cpp</a>.
<h3 class=fn>void <a name="refresh-2"></a>TQDataTable::refresh ( <a href="tqdatatable.html#Refresh-enum">Refresh</a>&nbsp;mode )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Refreshes the table. If there is no currently defined cursor (see
<a href="#setSqlCursor">setSqlCursor</a>()), nothing happens. The <em>mode</em> parameter determines
which type of refresh will take place.
<p> <p>See also <a href="#Refresh-enum">Refresh</a>, <a href="#setSqlCursor">setSqlCursor</a>(), and <a href="#addColumn">addColumn</a>().

<h3 class=fn>void <a name="removeColumn"></a>TQDataTable::removeColumn ( uint&nbsp;col )<tt> [virtual]</tt>
</h3>
Removes column <em>col</em> from the list of columns to be displayed. If
<em>col</em> does not exist, nothing happens.
<p> <p>See also <a href="tqsqlfield.html">TQSqlField</a>.

<h3 class=fn>void <a name="reset"></a>TQDataTable::reset ()<tt> [protected]</tt>
</h3>
Resets the table so that it displays no data.
<p> <p>See also <a href="#setSqlCursor">setSqlCursor</a>().

<h3 class=fn>void <a name="setAutoDelete"></a>TQDataTable::setAutoDelete ( bool&nbsp;enable )<tt> [virtual]</tt>
</h3>
Sets the cursor auto-delete flag to <em>enable</em>. If <em>enable</em> is
TRUE, the table will automatically delete the cursor specified by
<a href="#setSqlCursor">setSqlCursor</a>(). If <em>enable</em> is FALSE (the default), the cursor
will not be deleted.

<h3 class=fn>void <a name="setAutoEdit"></a>TQDataTable::setAutoEdit ( bool&nbsp;autoEdit )<tt> [virtual]</tt>
</h3><p>Sets whether the data table automatically applies edits to <em>autoEdit</em>.
See the <a href="tqdatatable.html#autoEdit-prop">"autoEdit"</a> property for details.
<h3 class=fn>void <a name="setColumn"></a>TQDataTable::setColumn ( uint&nbsp;col, const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;fieldName, const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;label = TQString::null, int&nbsp;width = -1, const&nbsp;<a href="tqiconset.html">TQIconSet</a>&nbsp;&amp;&nbsp;iconset = TQIconSet ( ) )<tt> [virtual]</tt>
</h3>
Sets the <em>col</em> column to display using the field <em>fieldName</em>,
column label <em>label</em>, width <em>width</em> and iconset <em>iconset</em>.
<p> If <em>label</em> is specified, it is used as the column's header label,
otherwise the field's display label is used when <a href="#setSqlCursor">setSqlCursor</a>() is
called. The <em>iconset</em> is used to set the icon used by the column
header; by default there is no icon.
<p> <p>See also <a href="#setSqlCursor">setSqlCursor</a>() and <a href="#refresh">refresh</a>().

<h3 class=fn>void <a name="setColumnWidth"></a>TQDataTable::setColumnWidth ( int&nbsp;col, int&nbsp;w )<tt> [virtual slot]</tt>
</h3>
Sets the column <em>col</em> to the width <em>w</em>. Note that unlike <a href="ntqtable.html">TQTable</a>
the TQDataTable is not immediately redrawn, you must call
<a href="#refresh">refresh</a>(TQDataTable::RefreshColumns)
yourself.
<p> <p>See also <a href="#refresh">refresh</a>().

<p>Reimplemented from <a href="ntqtable.html#setColumnWidth">TQTable</a>.
<h3 class=fn>void <a name="setConfirmCancels"></a>TQDataTable::setConfirmCancels ( bool&nbsp;confirm )<tt> [virtual]</tt>
</h3><p>Sets whether the data table confirms cancel operations to <em>confirm</em>.
See the <a href="tqdatatable.html#confirmCancels-prop">"confirmCancels"</a> property for details.
<h3 class=fn>void <a name="setConfirmDelete"></a>TQDataTable::setConfirmDelete ( bool&nbsp;confirm )<tt> [virtual]</tt>
</h3><p>Sets whether the data table confirms delete operations to <em>confirm</em>.
See the <a href="tqdatatable.html#confirmDelete-prop">"confirmDelete"</a> property for details.
<h3 class=fn>void <a name="setConfirmEdits"></a>TQDataTable::setConfirmEdits ( bool&nbsp;confirm )<tt> [virtual]</tt>
</h3><p>Sets whether the data table confirms edit operations to <em>confirm</em>.
See the <a href="tqdatatable.html#confirmEdits-prop">"confirmEdits"</a> property for details.
<h3 class=fn>void <a name="setConfirmInsert"></a>TQDataTable::setConfirmInsert ( bool&nbsp;confirm )<tt> [virtual]</tt>
</h3><p>Sets whether the data table confirms insert operations to <em>confirm</em>.
See the <a href="tqdatatable.html#confirmInsert-prop">"confirmInsert"</a> property for details.
<h3 class=fn>void <a name="setConfirmUpdate"></a>TQDataTable::setConfirmUpdate ( bool&nbsp;confirm )<tt> [virtual]</tt>
</h3><p>Sets whether the data table confirms update operations to <em>confirm</em>.
See the <a href="tqdatatable.html#confirmUpdate-prop">"confirmUpdate"</a> property for details.
<h3 class=fn>void <a name="setDateFormat"></a>TQDataTable::setDateFormat ( const&nbsp;<a href="ntqt.html#DateFormat-enum">DateFormat</a>&nbsp;f )<tt> [virtual]</tt>
</h3><p>Sets the format used for displaying date/time values to <em>f</em>.
See the <a href="tqdatatable.html#dateFormat-prop">"dateFormat"</a> property for details.
<h3 class=fn>void <a name="setFalseText"></a>TQDataTable::setFalseText ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;falseText )<tt> [virtual]</tt>
</h3><p>Sets the text used to represent false values to <em>falseText</em>.
See the <a href="tqdatatable.html#falseText-prop">"falseText"</a> property for details.
<h3 class=fn>void <a name="setFilter"></a>TQDataTable::setFilter ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;filter )<tt> [virtual]</tt>
</h3><p>Sets the data filter for the data table to <em>filter</em>.
See the <a href="tqdatatable.html#filter-prop">"filter"</a> property for details.
<h3 class=fn>void <a name="setNullText"></a>TQDataTable::setNullText ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;nullText )<tt> [virtual]</tt>
</h3><p>Sets the text used to represent NULL values to <em>nullText</em>.
See the <a href="tqdatatable.html#nullText-prop">"nullText"</a> property for details.
<h3 class=fn>void <a name="setSize"></a>TQDataTable::setSize ( <a href="tqsqlcursor.html">TQSqlCursor</a>&nbsp;*&nbsp;sql )<tt> [protected]</tt>
</h3>
If the cursor's <em>sql</em> driver supports query sizes, the number of
rows in the table is set to the size of the query. Otherwise, the
table dynamically resizes itself as it is scrolled. If <em>sql</em> is
not active, it is made active by issuing a select() on the cursor
using the <em>sql</em> cursor's current filter and current sort.

<h3 class=fn>void <a name="setSort"></a>TQDataTable::setSort ( const&nbsp;<a href="tqstringlist.html">TQStringList</a>&nbsp;&amp;&nbsp;sort )<tt> [virtual]</tt>
</h3><p>Sets the data table's sort to <em>sort</em>.
See the <a href="tqdatatable.html#sort-prop">"sort"</a> property for details.
<h3 class=fn>void <a name="setSort-2"></a>TQDataTable::setSort ( const&nbsp;<a href="tqsqlindex.html">TQSqlIndex</a>&nbsp;&amp;&nbsp;sort )<tt> [virtual]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the sort to be applied to the displayed data to <em>sort</em>. If
there is no current cursor, nothing happens. A <a href="tqsqlindex.html">TQSqlIndex</a> contains
field names and their ordering (ASC or DESC); these are used to
compose the ORDER BY clause.
<p> <p>See also <a href="#sort-prop">sort</a>.

<h3 class=fn>void <a name="setSqlCursor"></a>TQDataTable::setSqlCursor ( <a href="tqsqlcursor.html">TQSqlCursor</a>&nbsp;*&nbsp;cursor = 0, bool&nbsp;autoPopulate = FALSE, bool&nbsp;autoDelete = FALSE )<tt> [virtual]</tt>
</h3>
Sets <em>cursor</em> as the data source for the table. To force the
display of the data from <em>cursor</em>, use <a href="#refresh">refresh</a>(). If <em>autoPopulate</em> is TRUE, columns are automatically created based upon
the fields in the <em>cursor</em> record. If <em>autoDelete</em> is TRUE (the
default is FALSE), the table will take ownership of the <em>cursor</em>
and delete it when appropriate. If the <em>cursor</em> is read-only, the
table becomes read-only. The table adopts the cursor's driver's
definition for representing NULL values as strings.
<p> <p>See also <a href="#refresh">refresh</a>(), <a href="ntqtable.html#readOnly-prop">readOnly</a>, <a href="#setAutoDelete">setAutoDelete</a>(), and <a href="tqsqldriver.html#nullText">TQSqlDriver::nullText</a>().

<h3 class=fn>void <a name="setTrueText"></a>TQDataTable::setTrueText ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;trueText )<tt> [virtual]</tt>
</h3><p>Sets the text used to represent true values to <em>trueText</em>.
See the <a href="tqdatatable.html#trueText-prop">"trueText"</a> property for details.
<h3 class=fn><a href="tqstringlist.html">TQStringList</a> <a name="sort"></a>TQDataTable::sort () const
</h3><p>Returns the data table's sort.
See the <a href="tqdatatable.html#sort-prop">"sort"</a> property for details.
<h3 class=fn>void <a name="sortAscending"></a>TQDataTable::sortAscending ( int&nbsp;col )<tt> [virtual slot]</tt>
</h3>
Sorts column <em>col</em> in ascending order.
<p> <p>See also <a href="ntqtable.html#sorting-prop">sorting</a>.

<h3 class=fn>void <a name="sortColumn"></a>TQDataTable::sortColumn ( int&nbsp;col, bool&nbsp;ascending = TRUE, bool&nbsp;wholeRows = FALSE )<tt> [virtual]</tt>
</h3>
Sorts column <em>col</em> in ascending order if <em>ascending</em> is TRUE
(the default); otherwise sorts in descending order.
<p> The <em>wholeRows</em> parameter is ignored; TQDataTable always sorts
whole rows by the specified column.

<p>Reimplemented from <a href="ntqtable.html#sortColumn">TQTable</a>.
<h3 class=fn>void <a name="sortDescending"></a>TQDataTable::sortDescending ( int&nbsp;col )<tt> [virtual slot]</tt>
</h3>
Sorts column <em>col</em> in descending order.
<p> <p>See also <a href="ntqtable.html#sorting-prop">sorting</a>.

<h3 class=fn><a href="tqsqlcursor.html">TQSqlCursor</a>&nbsp;* <a name="sqlCursor"></a>TQDataTable::sqlCursor () const
</h3>
Returns the cursor used by the data table.

<h3 class=fn><a href="tqstring.html">TQString</a> <a name="text"></a>TQDataTable::text ( int&nbsp;row, int&nbsp;col ) const<tt> [virtual]</tt>
</h3>
Returns the text in cell <em>row</em>, <em>col</em>, or an empty string if the
cell is empty. If the cell's value is NULL then <a href="#nullText">nullText</a>() will be
returned. If the cell does not exist then <a href="tqstring.html#TQString-null">TQString::null</a> is
returned.

<p>Reimplemented from <a href="ntqtable.html#text">TQTable</a>.
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="trueText"></a>TQDataTable::trueText () const
</h3><p>Returns the text used to represent true values.
See the <a href="tqdatatable.html#trueText-prop">"trueText"</a> property for details.
<h3 class=fn>bool <a name="updateCurrent"></a>TQDataTable::updateCurrent ()<tt> [virtual protected]</tt>
</h3>
For an editable table, issues an update using the cursor's edit
buffer. If there is no current cursor or there is no current
selection, nothing happens. If <a href="#confirmEdits">confirmEdits</a>() or <a href="#confirmUpdate">confirmUpdate</a>()
is TRUE, <a href="#confirmEdit">confirmEdit</a>() is called to confirm the update. Returns
TRUE if the update succeeded; otherwise returns FALSE.
<p> The underlying cursor must have a valid primary index to ensure
that a unique record is updated within the database otherwise the
database may be changed to an inconsistent state.

<h3 class=fn><a href="ntqvariant.html">TQVariant</a> <a name="value"></a>TQDataTable::value ( int&nbsp;row, int&nbsp;col ) const
</h3>
Returns the value in cell <em>row</em>, <em>col</em>, or an invalid value if
the cell does not exist or has no value.

<hr><h2>Property Documentation</h2>
<h3 class=fn>bool <a name="autoEdit-prop"></a>autoEdit</h3>
<p>This property holds whether the data table automatically applies edits.
<p>The default value for this property is TRUE. When the user begins
an insert or update in the table there are two possible outcomes
when they navigate to another record:
<p> <ol type=1>
<li> the insert or update is is performed -- this occurs if autoEdit is TRUE
<li> the insert or update is abandoned -- this occurs if autoEdit is FALSE
</ol>

<p>Set this property's value with <a href="#setAutoEdit">setAutoEdit</a>() and get this property's value with <a href="#autoEdit">autoEdit</a>().
<h3 class=fn>bool <a name="confirmCancels-prop"></a>confirmCancels</h3>
<p>This property holds whether the data table confirms cancel operations.
<p>If the confirmCancel property is TRUE, all cancels must be
confirmed by the user through a message box (this behavior can be
changed by overriding the <a href="#confirmCancel">confirmCancel</a>() function), otherwise all
cancels occur immediately. The default is FALSE.
<p> <p>See also <a href="#confirmEdits-prop">confirmEdits</a> and <a href="#confirmCancel">confirmCancel</a>().

<p>Set this property's value with <a href="#setConfirmCancels">setConfirmCancels</a>() and get this property's value with <a href="#confirmCancels">confirmCancels</a>().
<h3 class=fn>bool <a name="confirmDelete-prop"></a>confirmDelete</h3>
<p>This property holds whether the data table confirms delete operations.
<p>If the confirmDelete property is TRUE, all deletions must be
confirmed by the user through a message box (this behaviour can be
changed by overriding the <a href="#confirmEdit">confirmEdit</a>() function), otherwise all
delete operations occur immediately.
<p> <p>See also <a href="#confirmCancels-prop">confirmCancels</a>, <a href="#confirmEdits-prop">confirmEdits</a>, <a href="#confirmUpdate-prop">confirmUpdate</a>, and <a href="#confirmInsert-prop">confirmInsert</a>.

<p>Set this property's value with <a href="#setConfirmDelete">setConfirmDelete</a>() and get this property's value with <a href="#confirmDelete">confirmDelete</a>().
<h3 class=fn>bool <a name="confirmEdits-prop"></a>confirmEdits</h3>
<p>This property holds whether the data table confirms edit operations.
<p>If the confirmEdits property is TRUE, the data table confirms all
edit operations (inserts, updates and deletes). Finer control of
edit confirmation can be achieved using <a href="#confirmCancels-prop">confirmCancels</a>, <a href="#confirmInsert-prop">confirmInsert</a>, <a href="#confirmUpdate-prop">confirmUpdate</a> and <a href="#confirmDelete-prop">confirmDelete</a>.
<p> <p>See also <a href="#confirmCancels-prop">confirmCancels</a>, <a href="#confirmInsert-prop">confirmInsert</a>, <a href="#confirmUpdate-prop">confirmUpdate</a>, and <a href="#confirmDelete-prop">confirmDelete</a>.

<p>Set this property's value with <a href="#setConfirmEdits">setConfirmEdits</a>() and get this property's value with <a href="#confirmEdits">confirmEdits</a>().
<h3 class=fn>bool <a name="confirmInsert-prop"></a>confirmInsert</h3>
<p>This property holds whether the data table confirms insert operations.
<p>If the confirmInsert property is TRUE, all insertions must be
confirmed by the user through a message box (this behaviour can be
changed by overriding the <a href="#confirmEdit">confirmEdit</a>() function), otherwise all
insert operations occur immediately.
<p> <p>See also <a href="#confirmCancels-prop">confirmCancels</a>, <a href="#confirmEdits-prop">confirmEdits</a>, <a href="#confirmUpdate-prop">confirmUpdate</a>, and <a href="#confirmDelete-prop">confirmDelete</a>.

<p>Set this property's value with <a href="#setConfirmInsert">setConfirmInsert</a>() and get this property's value with <a href="#confirmInsert">confirmInsert</a>().
<h3 class=fn>bool <a name="confirmUpdate-prop"></a>confirmUpdate</h3>
<p>This property holds whether the data table confirms update operations.
<p>If the confirmUpdate property is TRUE, all updates must be
confirmed by the user through a message box (this behaviour can be
changed by overriding the <a href="#confirmEdit">confirmEdit</a>() function), otherwise all
update operations occur immediately.
<p> <p>See also <a href="#confirmCancels-prop">confirmCancels</a>, <a href="#confirmEdits-prop">confirmEdits</a>, <a href="#confirmInsert-prop">confirmInsert</a>, and <a href="#confirmDelete-prop">confirmDelete</a>.

<p>Set this property's value with <a href="#setConfirmUpdate">setConfirmUpdate</a>() and get this property's value with <a href="#confirmUpdate">confirmUpdate</a>().
<h3 class=fn><a href="ntqt.html#DateFormat-enum">DateFormat</a> <a name="dateFormat-prop"></a>dateFormat</h3>
<p>This property holds the format used for displaying date/time values.
<p>The dateFormat property is used for displaying date/time values in
the table. The default value is <a href="ntqt.html#DateFormat-enum">TQt::LocalDate</a>.

<p>Set this property's value with <a href="#setDateFormat">setDateFormat</a>() and get this property's value with <a href="#dateFormat">dateFormat</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="falseText-prop"></a>falseText</h3>
<p>This property holds the text used to represent false values.
<p>The falseText property will be used to represent NULL values in
the table. The default value is "False".

<p>Set this property's value with <a href="#setFalseText">setFalseText</a>() and get this property's value with <a href="#falseText">falseText</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="filter-prop"></a>filter</h3>
<p>This property holds the data filter for the data table.
<p>The filter applies to the data shown in the table. To view data
with a new filter, use <a href="#refresh">refresh</a>(). A filter string is an SQL WHERE
clause without the WHERE keyword.
<p> There is no default filter.
<p> <p>See also <a href="#sort-prop">sort</a>.

<p> 
<p>Set this property's value with <a href="#setFilter">setFilter</a>() and get this property's value with <a href="#filter">filter</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="nullText-prop"></a>nullText</h3>
<p>This property holds the text used to represent NULL values.
<p>The nullText property will be used to represent NULL values in the
table. The default value is provided by the cursor's driver.

<p>Set this property's value with <a href="#setNullText">setNullText</a>() and get this property's value with <a href="#nullText">nullText</a>().
<h3 class=fn>int <a name="numCols-prop"></a>numCols</h3>
<p>This property holds the number of columns in the table.
<p>
<p>Get this property's value with <a href="#numCols">numCols</a>().
<h3 class=fn>int <a name="numRows-prop"></a>numRows</h3>
<p>This property holds the number of rows in the table.
<p>
<p>Get this property's value with <a href="#numRows">numRows</a>().
<h3 class=fn><a href="tqstringlist.html">TQStringList</a> <a name="sort-prop"></a>sort</h3>
<p>This property holds the data table's sort.
<p>The table's sort affects the order in which data records are
displayed in the table. To apply a sort, use <a href="#refresh">refresh</a>().
<p> When examining the sort property, a string list is returned with
each item having the form 'fieldname order' (e.g., 'id ASC',
'surname DESC').
<p> There is no default sort.
<p> Note that if you want to iterate over the sort list, you should
iterate over a copy, e.g.
<pre>
    <a href="tqstringlist.html">TQStringList</a> list = myDataTable.sort();
    TQStringList::Iterator it = list.<a href="tqvaluelist.html#begin">begin</a>();
    while( it != list.<a href="tqvaluelist.html#end">end</a>() ) {
        myProcessing( *it );
        ++it;
    }
    </pre>
 
<p> <p>See also <a href="#filter-prop">filter</a> and <a href="#refresh">refresh</a>().

<p>Set this property's value with <a href="#setSort">setSort</a>() and get this property's value with <a href="#sort">sort</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="trueText-prop"></a>trueText</h3>
<p>This property holds the text used to represent true values.
<p>The trueText property will be used to represent NULL values in the
table. The default value is "True".

<p>Set this property's value with <a href="#setTrueText">setTrueText</a>() and get this property's value with <a href="#trueText">trueText</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>