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
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
|
<!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/kernel/qapplication.cpp:76 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQApplication 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 Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped 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>TQApplication Class Reference</h1>
<p>The TQApplication class manages the GUI application's control
flow and main settings.
<a href="#details">More...</a>
<p><tt>#include <<a href="qapplication-h.html">ntqapplication.h</a>></tt>
<p>Inherits <a href="tqobject.html">TQObject</a>.
<p><a href="qapplication-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQApplication"><b>TQApplication</b></a> ( int & argc, char ** argv )</li>
<li class=fn><a href="#TQApplication-2"><b>TQApplication</b></a> ( int & argc, char ** argv, bool GUIenabled )</li>
<li class=fn>enum <a href="#Type-enum"><b>Type</b></a> { Tty, GuiClient, GuiServer }</li>
<li class=fn><a href="#TQApplication-3"><b>TQApplication</b></a> ( int & argc, char ** argv, Type type )</li>
<li class=fn><a href="#TQApplication-4"><b>TQApplication</b></a> ( Display * dpy, HANDLE visual = 0, HANDLE colormap = 0 )</li>
<li class=fn><a href="#TQApplication-5"><b>TQApplication</b></a> ( Display * dpy, int argc, char ** argv, HANDLE visual = 0, HANDLE colormap = 0 )</li>
<li class=fn>virtual <a href="#~TQApplication"><b>~TQApplication</b></a> ()</li>
<li class=fn>int <a href="#argc"><b>argc</b></a> () const</li>
<li class=fn>char ** <a href="#argv"><b>argv</b></a> () const</li>
<li class=fn>Type <a href="#type"><b>type</b></a> () const</li>
<li class=fn>enum <a href="#ColorSpec-enum"><b>ColorSpec</b></a> { NormalColor = 0, CustomColor = 1, ManyColor = 2 }</li>
<li class=fn>TQWidget * <a href="#mainWidget"><b>mainWidget</b></a> () const</li>
<li class=fn>virtual void <a href="#setMainWidget"><b>setMainWidget</b></a> ( TQWidget * mainWidget )</li>
<li class=fn>virtual void <a href="#polish"><b>polish</b></a> ( TQWidget * w )</li>
<li class=fn>TQWidget * <a href="#focusWidget"><b>focusWidget</b></a> () const</li>
<li class=fn>TQWidget * <a href="#activeWindow"><b>activeWindow</b></a> () const</li>
<li class=fn>int <a href="#exec"><b>exec</b></a> ()</li>
<li class=fn>void <a href="#processEvents"><b>processEvents</b></a> ()</li>
<li class=fn>void <a href="#processEvents-2"><b>processEvents</b></a> ( int maxtime )</li>
<li class=fn>void processOneEvent () <em>(obsolete)</em></li>
<li class=fn>bool <a href="#hasPendingEvents"><b>hasPendingEvents</b></a> ()</li>
<li class=fn>int enter_loop () <em>(obsolete)</em></li>
<li class=fn>void exit_loop () <em>(obsolete)</em></li>
<li class=fn>int loopLevel () const <em>(obsolete)</em></li>
<li class=fn>virtual bool <a href="#notify"><b>notify</b></a> ( TQObject * receiver, TQEvent * e )</li>
<li class=fn>void setDefaultCodec ( TQTextCodec * codec ) <em>(obsolete)</em></li>
<li class=fn>TQTextCodec * defaultCodec () const <em>(obsolete)</em></li>
<li class=fn>void <a href="#installTranslator"><b>installTranslator</b></a> ( TQTranslator * mf )</li>
<li class=fn>void <a href="#removeTranslator"><b>removeTranslator</b></a> ( TQTranslator * mf )</li>
<li class=fn>enum <a href="#Encoding-enum"><b>Encoding</b></a> { DefaultCodec, UnicodeUTF8 }</li>
<li class=fn>TQString <a href="#translate"><b>translate</b></a> ( const char * context, const char * sourceText, const char * comment = 0, Encoding encoding = DefaultCodec ) const</li>
<li class=fn>TQString <a href="#applicationDirPath"><b>applicationDirPath</b></a> ()</li>
<li class=fn>TQString <a href="#applicationFilePath"><b>applicationFilePath</b></a> ()</li>
<li class=fn>virtual bool <a href="#macEventFilter"><b>macEventFilter</b></a> ( EventHandlerCallRef, EventRef )</li>
<li class=fn>virtual bool <a href="#winEventFilter"><b>winEventFilter</b></a> ( MSG * )</li>
<li class=fn>virtual bool <a href="#x11EventFilter"><b>x11EventFilter</b></a> ( XEvent * )</li>
<li class=fn>int <a href="#x11ProcessEvent"><b>x11ProcessEvent</b></a> ( XEvent * event )</li>
<li class=fn>void <a href="#winFocus"><b>winFocus</b></a> ( TQWidget * widget, bool gotFocus )</li>
<li class=fn>bool <a href="#isSessionRestored"><b>isSessionRestored</b></a> () const</li>
<li class=fn>TQString <a href="#sessionId"><b>sessionId</b></a> () const</li>
<li class=fn>TQString <a href="#sessionKey"><b>sessionKey</b></a> () const</li>
<li class=fn>virtual void <a href="#commitData"><b>commitData</b></a> ( TQSessionManager & sm )</li>
<li class=fn>virtual void <a href="#saveState"><b>saveState</b></a> ( TQSessionManager & sm )</li>
<li class=fn>void <a href="#wakeUpGuiThread"><b>wakeUpGuiThread</b></a> ()</li>
<li class=fn>void <a href="#lock"><b>lock</b></a> ()</li>
<li class=fn>void <a href="#unlock"><b>unlock</b></a> ( bool wakeUpGui = TRUE )</li>
<li class=fn>bool <a href="#locked"><b>locked</b></a> ()</li>
<li class=fn>bool <a href="#tryLock"><b>tryLock</b></a> ()</li>
</ul>
<h2>Public Slots</h2>
<ul>
<li class=fn>void <a href="#quit"><b>quit</b></a> ()</li>
<li class=fn>void <a href="#closeAllWindows"><b>closeAllWindows</b></a> ()</li>
<li class=fn>void <a href="#aboutTQt"><b>aboutTQt</b></a> ()</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#lastWindowClosed"><b>lastWindowClosed</b></a> ()</li>
<li class=fn>void <a href="#aboutToQuit"><b>aboutToQuit</b></a> ()</li>
<li class=fn>void <a href="#guiThreadAwake"><b>guiThreadAwake</b></a> ()</li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li class=fn>TQStyle & <a href="#style"><b>style</b></a> ()</li>
<li class=fn>void <a href="#setStyle"><b>setStyle</b></a> ( TQStyle * style )</li>
<li class=fn>TQStyle * <a href="#setStyle-2"><b>setStyle</b></a> ( const TQString & style )</li>
<li class=fn>int <a href="#colorSpec"><b>colorSpec</b></a> ()</li>
<li class=fn>void <a href="#setColorSpec"><b>setColorSpec</b></a> ( int spec )</li>
<li class=fn>TQCursor * <a href="#overrideCursor"><b>overrideCursor</b></a> ()</li>
<li class=fn>void <a href="#setOverrideCursor"><b>setOverrideCursor</b></a> ( const TQCursor & cursor, bool replace = FALSE )</li>
<li class=fn>void <a href="#restoreOverrideCursor"><b>restoreOverrideCursor</b></a> ()</li>
<li class=fn>bool <a href="#hasGlobalMouseTracking"><b>hasGlobalMouseTracking</b></a> ()</li>
<li class=fn>void <a href="#setGlobalMouseTracking"><b>setGlobalMouseTracking</b></a> ( bool enable )</li>
<li class=fn>TQPalette <a href="#palette"><b>palette</b></a> ( const TQWidget * w = 0 )</li>
<li class=fn>void <a href="#setPalette"><b>setPalette</b></a> ( const TQPalette & palette, bool informWidgets = FALSE, const char * className = 0 )</li>
<li class=fn>TQFont <a href="#font"><b>font</b></a> ( const TQWidget * w = 0 )</li>
<li class=fn>void <a href="#setFont"><b>setFont</b></a> ( const TQFont & font, bool informWidgets = FALSE, const char * className = 0 )</li>
<li class=fn>TQFontMetrics <a href="#fontMetrics"><b>fontMetrics</b></a> ()</li>
<li class=fn>TQWidgetList * <a href="#allWidgets"><b>allWidgets</b></a> ()</li>
<li class=fn>TQWidgetList * <a href="#topLevelWidgets"><b>topLevelWidgets</b></a> ()</li>
<li class=fn>TQDesktopWidget * <a href="#desktop"><b>desktop</b></a> ()</li>
<li class=fn>TQWidget * <a href="#activePopupWidget"><b>activePopupWidget</b></a> ()</li>
<li class=fn>TQWidget * <a href="#activeModalWidget"><b>activeModalWidget</b></a> ()</li>
<li class=fn>TQClipboard * <a href="#clipboard"><b>clipboard</b></a> ()</li>
<li class=fn>TQWidget * <a href="#widgetAt"><b>widgetAt</b></a> ( int x, int y, bool child = FALSE )</li>
<li class=fn>TQWidget * <a href="#widgetAt-2"><b>widgetAt</b></a> ( const TQPoint & pos, bool child = FALSE )</li>
<li class=fn>TQEventLoop * <a href="#eventLoop"><b>eventLoop</b></a> ()</li>
<li class=fn>void <a href="#exit"><b>exit</b></a> ( int retcode = 0 )</li>
<li class=fn>bool <a href="#sendEvent"><b>sendEvent</b></a> ( TQObject * receiver, TQEvent * event )</li>
<li class=fn>void <a href="#postEvent"><b>postEvent</b></a> ( TQObject * receiver, TQEvent * event )</li>
<li class=fn>void <a href="#sendPostedEvents"><b>sendPostedEvents</b></a> ( TQObject * receiver, int event_type )</li>
<li class=fn>void <a href="#sendPostedEvents-2"><b>sendPostedEvents</b></a> ()</li>
<li class=fn>void <a href="#removePostedEvents"><b>removePostedEvents</b></a> ( TQObject * receiver )</li>
<li class=fn>bool <a href="#startingUp"><b>startingUp</b></a> ()</li>
<li class=fn>bool <a href="#closingDown"><b>closingDown</b></a> ()</li>
<li class=fn>void <a href="#flushX"><b>flushX</b></a> ()</li>
<li class=fn>void <a href="#flush"><b>flush</b></a> ()</li>
<li class=fn>void <a href="#syncX"><b>syncX</b></a> ()</li>
<li class=fn>void <a href="#beep"><b>beep</b></a> ()</li>
<li class=fn>void setWinStyleHighlightColor ( const TQColor & c ) <em>(obsolete)</em></li>
<li class=fn>const TQColor & winStyleHighlightColor () <em>(obsolete)</em></li>
<li class=fn>void <a href="#setDesktopSettingsAware"><b>setDesktopSettingsAware</b></a> ( bool on )</li>
<li class=fn>bool <a href="#desktopSettingsAware"><b>desktopSettingsAware</b></a> ()</li>
<li class=fn>void <a href="#setCursorFlashTime"><b>setCursorFlashTime</b></a> ( int msecs )</li>
<li class=fn>int <a href="#cursorFlashTime"><b>cursorFlashTime</b></a> ()</li>
<li class=fn>void <a href="#setDoubleClickInterval"><b>setDoubleClickInterval</b></a> ( int ms )</li>
<li class=fn>int <a href="#doubleClickInterval"><b>doubleClickInterval</b></a> ()</li>
<li class=fn>void <a href="#setWheelScrollLines"><b>setWheelScrollLines</b></a> ( int n )</li>
<li class=fn>int <a href="#wheelScrollLines"><b>wheelScrollLines</b></a> ()</li>
<li class=fn>void <a href="#setGlobalStrut"><b>setGlobalStrut</b></a> ( const TQSize & strut )</li>
<li class=fn>TQSize <a href="#globalStrut"><b>globalStrut</b></a> ()</li>
<li class=fn>void <a href="#setLibraryPaths"><b>setLibraryPaths</b></a> ( const TQStringList & paths )</li>
<li class=fn>TQStringList <a href="#libraryPaths"><b>libraryPaths</b></a> ()</li>
<li class=fn>void <a href="#addLibraryPath"><b>addLibraryPath</b></a> ( const TQString & path )</li>
<li class=fn>void <a href="#removeLibraryPath"><b>removeLibraryPath</b></a> ( const TQString & path )</li>
<li class=fn>void <a href="#setStartDragTime"><b>setStartDragTime</b></a> ( int ms )</li>
<li class=fn>int <a href="#startDragTime"><b>startDragTime</b></a> ()</li>
<li class=fn>void <a href="#setStartDragDistance"><b>setStartDragDistance</b></a> ( int l )</li>
<li class=fn>int <a href="#startDragDistance"><b>startDragDistance</b></a> ()</li>
<li class=fn>void <a href="#setReverseLayout"><b>setReverseLayout</b></a> ( bool b )</li>
<li class=fn>bool <a href="#reverseLayout"><b>reverseLayout</b></a> ()</li>
<li class=fn>int <a href="#horizontalAlignment"><b>horizontalAlignment</b></a> ( int align )</li>
<li class=fn>bool <a href="#isEffectEnabled"><b>isEffectEnabled</b></a> ( TQt::UIEffect effect )</li>
<li class=fn>void <a href="#setEffectEnabled"><b>setEffectEnabled</b></a> ( TQt::UIEffect effect, bool enable = TRUE )</li>
</ul>
<h2>Related Functions</h2>
<ul>
<li class=fn>void <a href="#qAddPostRoutine"><b>tqAddPostRoutine</b></a> ( TQtCleanUpFunction p )</li>
<li class=fn>const char * <a href="#qVersion"><b>tqVersion</b></a> ()</li>
<li class=fn>bool <a href="#qSysInfo"><b>tqSysInfo</b></a> ( int * wordSize, bool * bigEndian )</li>
<li class=fn>void <a href="#qDebug"><b>tqDebug</b></a> ( const char * msg, ... )</li>
<li class=fn>void <a href="#qWarning"><b>tqWarning</b></a> ( const char * msg, ... )</li>
<li class=fn>void <a href="#qFatal"><b>tqFatal</b></a> ( const char * msg, ... )</li>
<li class=fn>void <a href="#qSystemWarning"><b>tqSystemWarning</b></a> ( const char * msg, int code )</li>
<li class=fn>void <a href="#Q_ASSERT"><b>Q_ASSERT</b></a> ( bool test )</li>
<li class=fn>void <a href="#TQ_CHECK_PTR"><b>TQ_CHECK_PTR</b></a> ( void * p )</li>
<li class=fn>TQtMsgHandler <a href="#qInstallMsgHandler"><b>qInstallMsgHandler</b></a> ( TQtMsgHandler h )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQApplication class manages the GUI application's control
flow and main settings.
<p>
<p> It contains the main event loop, where all events from the window
system and other sources are processed and dispatched. It also
handles the application's initialization and finalization, and
provides session management. It also handles most system-wide and
application-wide settings.
<p> For any GUI application that uses TQt, there is precisely one
TQApplication object, no matter whether the application has 0, 1, 2
or more windows at any time.
<p> The TQApplication object is accessible through the global pointer <tt>tqApp</tt>. Its main areas of responsibility are:
<ul>
<p> <li> It initializes the application with the user's desktop settings
such as <a href="#palette">palette</a>(), <a href="#font">font</a>() and <a href="#doubleClickInterval">doubleClickInterval</a>(). It keeps track
of these properties in case the user changes the desktop globally, for
example through some kind of control panel.
<p> <li> It performs event handling, meaning that it receives events
from the underlying window system and dispatches them to the relevant
widgets. By using <a href="#sendEvent">sendEvent</a>() and <a href="#postEvent">postEvent</a>() you can send your own
events to widgets.
<p> <li> It parses common command line arguments and sets its internal
state accordingly. See the <a href="#TQApplication">constructor documentation</a> below for more details about this.
<p> <li> It defines the application's look and feel, which is
encapsulated in a <a href="tqstyle.html">TQStyle</a> object. This can be changed at runtime
with <a href="#setStyle">setStyle</a>().
<p> <li> It specifies how the application is to allocate colors.
See <a href="#setColorSpec">setColorSpec</a>() for details.
<p> <li> It provides <a href="i18n.html#localization">localization</a> of strings that are visible to the user
via <a href="#translate">translate</a>().
<p> <li> It provides some magical objects like the <a href="#desktop">desktop</a>() and the
<a href="#clipboard">clipboard</a>().
<p> <li> It knows about the application's windows. You can ask which
widget is at a certain position using <a href="#widgetAt">widgetAt</a>(), get a list of
<a href="#topLevelWidgets">topLevelWidgets</a>() and <a href="#closeAllWindows">closeAllWindows</a>(), etc.
<p> <li> It manages the application's mouse cursor handling,
see <a href="#setOverrideCursor">setOverrideCursor</a>() and <a href="#setGlobalMouseTracking">setGlobalMouseTracking</a>().
<p> <li> On the X window system, it provides functions to flush and sync
the communication stream, see <a href="#flushX">flushX</a>() and <a href="#syncX">syncX</a>().
<p> <li> It provides support for sophisticated <a href="session.html">session management</a>. This makes it possible
for applications to terminate gracefully when the user logs out, to
cancel a shutdown process if termination isn't possible and even to
preserve the entire application's state for a future session. See
<a href="#isSessionRestored">isSessionRestored</a>(), <a href="#sessionId">sessionId</a>() and <a href="#commitData">commitData</a>() and <a href="#saveState">saveState</a>()
for details.
<p> </ul>
<p> The <a href="simple-application.html">Application walk-through
example</a> contains a typical complete main() that does the usual
things with TQApplication.
<p> Since the TQApplication object does so much initialization, it
<b>must</b> be created before any other objects related to the user
interface are created.
<p> Since it also deals with common command line arguments, it is
usually a good idea to create it <em>before</em> any interpretation or
modification of <tt>argv</tt> is done in the application itself. (Note
also that for X11, <a href="#setMainWidget">setMainWidget</a>() may change the main widget
according to the <tt>-geometry</tt> option. To preserve this
functionality, you must set your defaults before setMainWidget() and
any overrides after.)
<p> <center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top" colspan="2" rowspan="1"> Groups of functions
<tr bgcolor="#f0f0f0">
<td valign="top">System settings
<td valign="top">
<a href="#desktopSettingsAware">desktopSettingsAware</a>(),
<a href="#setDesktopSettingsAware">setDesktopSettingsAware</a>(),
<a href="#cursorFlashTime">cursorFlashTime</a>(),
<a href="#setCursorFlashTime">setCursorFlashTime</a>(),
<a href="#doubleClickInterval">doubleClickInterval</a>(),
<a href="#setDoubleClickInterval">setDoubleClickInterval</a>(),
<a href="#wheelScrollLines">wheelScrollLines</a>(),
<a href="#setWheelScrollLines">setWheelScrollLines</a>(),
<a href="#palette">palette</a>(),
<a href="#setPalette">setPalette</a>(),
<a href="#font">font</a>(),
<a href="#setFont">setFont</a>(),
<a href="#fontMetrics">fontMetrics</a>().
<tr bgcolor="#d0d0d0">
<td valign="top">Event handling
<td valign="top">
<a href="#exec">exec</a>(),
<a href="#processEvents">processEvents</a>(),
<a href="#enter_loop">enter_loop</a>(),
<a href="#exit_loop">exit_loop</a>(),
<a href="#exit">exit</a>(),
<a href="#quit">quit</a>().
<a href="#sendEvent">sendEvent</a>(),
<a href="#postEvent">postEvent</a>(),
<a href="#sendPostedEvents">sendPostedEvents</a>(),
<a href="#removePostedEvents">removePostedEvents</a>(),
<a href="#hasPendingEvents">hasPendingEvents</a>(),
<a href="#notify">notify</a>(),
<a href="#macEventFilter">macEventFilter</a>(),
<a href="#x11EventFilter">x11EventFilter</a>(),
<a href="#x11ProcessEvent">x11ProcessEvent</a>(),
<a href="#winEventFilter">winEventFilter</a>().
<tr bgcolor="#f0f0f0">
<td valign="top">GUI Styles
<td valign="top">
<a href="#style">style</a>(),
<a href="#setStyle">setStyle</a>(),
<a href="#polish">polish</a>().
<tr bgcolor="#d0d0d0">
<td valign="top">Color usage
<td valign="top">
<a href="#colorSpec">colorSpec</a>(),
<a href="#setColorSpec">setColorSpec</a>(),
<tr bgcolor="#f0f0f0">
<td valign="top">Text handling
<td valign="top">
<a href="#installTranslator">installTranslator</a>(),
<a href="#removeTranslator">removeTranslator</a>()
<a href="#translate">translate</a>().
<tr bgcolor="#d0d0d0">
<td valign="top">Widgets
<td valign="top">
<a href="#mainWidget">mainWidget</a>(),
<a href="#setMainWidget">setMainWidget</a>(),
<a href="#allWidgets">allWidgets</a>(),
<a href="#topLevelWidgets">topLevelWidgets</a>(),
<a href="#desktop">desktop</a>(),
<a href="#activePopupWidget">activePopupWidget</a>(),
<a href="#activeModalWidget">activeModalWidget</a>(),
<a href="#clipboard">clipboard</a>(),
<a href="#focusWidget">focusWidget</a>(),
<a href="#winFocus">winFocus</a>(),
<a href="#activeWindow">activeWindow</a>(),
<a href="#widgetAt">widgetAt</a>().
<tr bgcolor="#f0f0f0">
<td valign="top">Advanced cursor handling
<td valign="top">
<a href="#hasGlobalMouseTracking">hasGlobalMouseTracking</a>(),
<a href="#setGlobalMouseTracking">setGlobalMouseTracking</a>(),
<a href="#overrideCursor">overrideCursor</a>(),
<a href="#setOverrideCursor">setOverrideCursor</a>(),
<a href="#restoreOverrideCursor">restoreOverrideCursor</a>().
<tr bgcolor="#d0d0d0">
<td valign="top">X Window System synchronization
<td valign="top">
<a href="#flushX">flushX</a>(),
<a href="#syncX">syncX</a>().
<tr bgcolor="#f0f0f0">
<td valign="top">Session management
<td valign="top">
<a href="#isSessionRestored">isSessionRestored</a>(),
<a href="#sessionId">sessionId</a>(),
<a href="#commitData">commitData</a>(),
<a href="#saveState">saveState</a>().
<tr bgcolor="#d0d0d0">
<td valign="top">Threading
<td valign="top">
<a href="#lock">lock</a>(), <a href="#unlock">unlock</a>(), <a href="#locked">locked</a>(), <a href="#tryLock">tryLock</a>(),
<a href="#wakeUpGuiThread">wakeUpGuiThread</a>()
<tr bgcolor="#f0f0f0">
<td valign="top">Miscellaneous
<td valign="top">
<a href="#closeAllWindows">closeAllWindows</a>(),
<a href="#startingUp">startingUp</a>(),
<a href="#closingDown">closingDown</a>(),
<a href="#type">type</a>().
</table></center>
<p> <em>Non-GUI programs:</em> While TQt is not optimized or
designed for writing non-GUI programs, it's possible to use
<a href="tools.html">some of its classes</a> without creating a
TQApplication. This can be useful if you wish to share code between
a non-GUI server and a GUI client.
<p>See also <a href="application.html">Main Window and Related Classes</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="ColorSpec-enum"></a>TQApplication::ColorSpec</h3>
<ul>
<li><tt>TQApplication::NormalColor</tt> - the default color allocation policy
<li><tt>TQApplication::CustomColor</tt> - the same as NormalColor for X11; allocates colors
to a palette on demand under Windows
<li><tt>TQApplication::ManyColor</tt> - the right choice for applications that use thousands of
colors
</ul><p> See <a href="#setColorSpec">setColorSpec</a>() for full details.
<h3 class=fn><a name="Encoding-enum"></a>TQApplication::Encoding</h3>
<p> This enum type defines the 8-bit encoding of character string
arguments to <a href="#translate">translate</a>():
<ul>
<li><tt>TQApplication::DefaultCodec</tt> - the encoding specified by
<a href="tqtextcodec.html#codecForTr">TQTextCodec::codecForTr</a>() (Latin-1 if none has been set)
<li><tt>TQApplication::UnicodeUTF8</tt> - UTF-8
</ul><p> <p>See also <a href="tqobject.html#tr">TQObject::tr</a>(), <a href="tqobject.html#trUtf8">TQObject::trUtf8</a>(), and <a href="tqstring.html#fromUtf8">TQString::fromUtf8</a>().
<h3 class=fn><a name="Type-enum"></a>TQApplication::Type</h3>
<ul>
<li><tt>TQApplication::Tty</tt> - a console application
<li><tt>TQApplication::GuiClient</tt> - a GUI client application
<li><tt>TQApplication::GuiServer</tt> - a GUI server application
</ul>
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQApplication"></a>TQApplication::TQApplication ( int & argc, char ** argv )
</h3>
Initializes the window system and constructs an application object
with <em>argc</em> command line arguments in <em>argv</em>.
<p> The global <tt>tqApp</tt> pointer refers to this application object. Only
one application object should be created.
<p> This application object must be constructed before any <a href="tqpaintdevice.html">paint devices</a> (including widgets, pixmaps, bitmaps
etc.).
<p> Note that <em>argc</em> and <em>argv</em> might be changed. TQt removes command
line arguments that it recognizes. The modified <em>argc</em> and <em>argv</em>
can also be accessed later with <tt>tqApp->argc()</tt> and <tt>tqApp->argv()</tt>.
The documentation for <a href="#argv">argv</a>() contains a detailed description of how
to process command line arguments.
<p> TQt debugging options (not available if TQt was compiled with the
TQT_NO_DEBUG flag defined):
<ul>
<li> -nograb, tells TQt that it must never grab the mouse or the keyboard.
<li> -dograb (only under X11), running under a debugger can cause
an implicit -nograb, use -dograb to override.
<li> -sync (only under X11), switches to synchronous mode for
debugging.
</ul>
<p> See <a href="debug.html">Debugging Techniques</a> for a more
detailed explanation.
<p> All TQt programs automatically support the following command line options:
<ul>
<li> -reverse causes text to be formatted for right-to-left languages
rather than in the usual left-to-right direction.
<li> -style= <em>style</em>, sets the application GUI style. Possible values
are <tt>motif</tt>, <tt>windows</tt>, and <tt>platinum</tt>. If you compiled TQt
with additional styles or have additional styles as plugins these
will be available to the <tt>-style</tt> command line option.
<li> -style <em>style</em>, is the same as listed above.
<li> -session= <em>session</em>, restores the application from an earlier
<a href="session.html">session</a>.
<li> -session <em>session</em>, is the same as listed above.
<li> -widgetcount, prints debug message at the end about number of widgets left
undestroyed and maximum number of widgets existed at the same time
</ul>
<p> The X11 version of TQt also supports some traditional X11
command line options:
<ul>
<li> -display <em>display</em>, sets the X display (default is $DISPLAY).
<li> -geometry <em>geometry</em>, sets the client geometry of the
<a href="#setMainWidget">main widget</a>.
<li> -fn or <tt>-font</tt> <em>font</em>, defines the application font. The
font should be specified using an X logical font description.
<li> -bg or <tt>-background</tt> <em>color</em>, sets the default background color
and an application palette (light and dark shades are calculated).
<li> -fg or <tt>-foreground</tt> <em>color</em>, sets the default foreground color.
<li> -btn or <tt>-button</tt> <em>color</em>, sets the default button color.
<li> -name <em>name</em>, sets the application name.
<li> -title <em>title</em>, sets the application title (caption).
<li> -visual <tt>TrueColor</tt>, forces the application to use a TrueColor visual
on an 8-bit display.
<li> -ncols <em>count</em>, limits the number of colors allocated in the
color cube on an 8-bit display, if the application is using the
<a href="#ColorSpec-enum">TQApplication::ManyColor</a> color specification. If <em>count</em> is
216 then a 6x6x6 color cube is used (i.e. 6 levels of red, 6 of green,
and 6 of blue); for other values, a cube
approximately proportional to a 2x3x1 cube is used.
<li> -cmap, causes the application to install a private color map
on an 8-bit display.
</ul>
<p> <p>See also <a href="#argc">argc</a>() and <a href="#argv">argv</a>().
<h3 class=fn><a name="TQApplication-2"></a>TQApplication::TQApplication ( int & argc, char ** argv, bool GUIenabled )
</h3>
Constructs an application object with <em>argc</em> command line arguments
in <em>argv</em>. If <em>GUIenabled</em> is TRUE, a GUI application is
constructed, otherwise a non-GUI (console) application is created.
<p> Set <em>GUIenabled</em> to FALSE for programs without a graphical user
interface that should be able to run without a window system.
<p> On X11, the window system is initialized if <em>GUIenabled</em> is TRUE.
If <em>GUIenabled</em> is FALSE, the application does not connect to the
X-server.
On Windows and Macintosh, currently the window system is always
initialized, regardless of the value of GUIenabled. This may change in
future versions of TQt.
<p> The following example shows how to create an application that
uses a graphical interface when available.
<pre>
int main( int argc, char **argv )
{
#ifdef TQ_WS_X11
bool useGUI = getenv( "DISPLAY" ) != 0;
#else
bool useGUI = TRUE;
#endif
TQApplication app(argc, argv, useGUI);
if ( useGUI ) {
//start GUI version
...
} else {
//start non-GUI version
...
}
return app.<a href="#exec">exec</a>();
}
</pre>
<h3 class=fn><a name="TQApplication-3"></a>TQApplication::TQApplication ( int & argc, char ** argv, <a href="ntqapplication.html#Type-enum">Type</a> type )
</h3>
Constructs an application object with <em>argc</em> command line arguments
in <em>argv</em>.
<h3 class=fn><a name="TQApplication-4"></a>TQApplication::TQApplication ( Display * dpy, HANDLE visual = 0, HANDLE colormap = 0 )
</h3>
Create an application, given an already open display <em>dpy</em>. If <em>visual</em> and <em>colormap</em> are non-zero, the application will use those as
the default Visual and Colormap contexts.
<p> <b>Warning:</b> TQt only supports TrueColor visuals at depths higher than 8
bits-per-pixel.
<p> This is available only on X11.
<h3 class=fn><a name="TQApplication-5"></a>TQApplication::TQApplication ( Display * dpy, int argc, char ** argv, HANDLE visual = 0, HANDLE colormap = 0 )
</h3>
Create an application, given an already open display <em>dpy</em> and using
<em>argc</em> command line arguments in <em>argv</em>. If <em>visual</em> and <em>colormap</em> are non-zero, the application will use those as
the default Visual and Colormap contexts.
<p> <b>Warning:</b> TQt only supports TrueColor visuals at depths higher than 8
bits-per-pixel.
<p> This is available only on X11.
<p>
<h3 class=fn><a name="~TQApplication"></a>TQApplication::~TQApplication ()<tt> [virtual]</tt>
</h3>
Cleans up any window system resources that were allocated by this
application. Sets the global variable <tt>tqApp</tt> to 0.
<h3 class=fn>void <a name="aboutTQt"></a>TQApplication::aboutTQt ()<tt> [slot]</tt>
</h3>
Displays a simple message box about TQt. The message includes the
version number of TQt being used by the application.
<p> This is useful for inclusion in the Help menu of an application.
See the examples/menu/menu.cpp example.
<p> This function is a convenience slot for <a href="ntqmessagebox.html#aboutTQt">TQMessageBox::aboutTQt</a>().
<h3 class=fn>void <a name="aboutToQuit"></a>TQApplication::aboutToQuit ()<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the application is about to quit the
main event loop, e.g. when the event loop level drops to zero.
This may happen either after a call to <a href="#quit">quit</a>() from inside the
application or when the users shuts down the entire desktop session.
<p> The signal is particularly useful if your application has to do some
last-second cleanup. Note that no user interaction is possible in
this state.
<p> <p>See also <a href="#quit">quit</a>().
<h3 class=fn><a href="tqwidget.html">TQWidget</a> * <a name="activeModalWidget"></a>TQApplication::activeModalWidget ()<tt> [static]</tt>
</h3>
Returns the active modal widget.
<p> A modal widget is a special top level widget which is a subclass of
<a href="tqdialog.html">TQDialog</a> that specifies the modal parameter of the constructor as
TRUE. A modal widget must be closed before the user can continue
with other parts of the program.
<p> Modal widgets are organized in a stack. This function returns
the active modal widget at the top of the stack.
<p> <p>See also <a href="#activePopupWidget">activePopupWidget</a>() and <a href="#topLevelWidgets">topLevelWidgets</a>().
<h3 class=fn><a href="tqwidget.html">TQWidget</a> * <a name="activePopupWidget"></a>TQApplication::activePopupWidget ()<tt> [static]</tt>
</h3>
Returns the active popup widget.
<p> A popup widget is a special top level widget that sets the <a href="ntqt.html#WidgetFlags-enum">WType_Popup</a> widget flag, e.g. the <a href="tqpopupmenu.html">TQPopupMenu</a> widget. When the
application opens a popup widget, all events are sent to the popup.
Normal widgets and modal widgets cannot be accessed before the popup
widget is closed.
<p> Only other popup widgets may be opened when a popup widget is shown.
The popup widgets are organized in a stack. This function returns
the active popup widget at the top of the stack.
<p> <p>See also <a href="#activeModalWidget">activeModalWidget</a>() and <a href="#topLevelWidgets">topLevelWidgets</a>().
<h3 class=fn><a href="tqwidget.html">TQWidget</a> * <a name="activeWindow"></a>TQApplication::activeWindow () const
</h3>
<p> Returns the application top-level window that has the keyboard input
focus, or 0 if no application window has the focus. Note that
there might be an <a href="#activeWindow">activeWindow</a>() even if there is no <a href="#focusWidget">focusWidget</a>(),
for example if no widget in that window accepts key events.
<p> <p>See also <a href="tqwidget.html#setFocus">TQWidget::setFocus</a>(), <a href="tqwidget.html#focus-prop">TQWidget::focus</a>, and <a href="#focusWidget">focusWidget</a>().
<p>Example: <a href="mail-example.html#x704">network/mail/smtp.cpp</a>.
<h3 class=fn>void <a name="addLibraryPath"></a>TQApplication::addLibraryPath ( const <a href="tqstring.html">TQString</a> & path )<tt> [static]</tt>
</h3>
Append <em>path</em> to the end of the library path list. If <em>path</em> is
empty or already in the path list, the path list is not changed.
<p> The default path list consists of a single entry, the installation
directory for plugins. The default installation directory for plugins
is <tt>INSTALL/plugins</tt>, where <tt>INSTALL</tt> is the directory where TQt was
installed.
<p> <p>See also <a href="#removeLibraryPath">removeLibraryPath</a>(), <a href="#libraryPaths">libraryPaths</a>(), and <a href="#setLibraryPaths">setLibraryPaths</a>().
<h3 class=fn>TQWidgetList * <a name="allWidgets"></a>TQApplication::allWidgets ()<tt> [static]</tt>
</h3>
Returns a list of all the widgets in the application.
<p> The list is created using <tt>new</tt> and must be deleted by the caller.
<p> The list is empty (<a href="tqptrlist.html#isEmpty">TQPtrList::isEmpty</a>()) if there are no widgets.
<p> Note that some of the widgets may be hidden.
<p> Example that updates all widgets:
<pre>
TQWidgetList *list = TQApplication::<a href="#allWidgets">allWidgets</a>();
TQWidgetListIt it( *list ); // iterate over the widgets
<a href="tqwidget.html">TQWidget</a> * w;
while ( (w=it.current()) != 0 ) { // for each widget...
++it;
w-><a href="tqwidget.html#update">update</a>();
}
delete list; // delete the list, not the widgets
</pre>
<p> The TQWidgetList class is defined in the <tt>tqwidgetlist.h</tt> header
file.
<p> <b>Warning:</b> Delete the list as soon as you have finished using it.
The widgets in the list may be deleted by someone else at any time.
<p> <p>See also <a href="#topLevelWidgets">topLevelWidgets</a>(), <a href="tqwidget.html#visible-prop">TQWidget::visible</a>, and <a href="tqptrlist.html#isEmpty">TQPtrList::isEmpty</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="applicationDirPath"></a>TQApplication::applicationDirPath ()
</h3>
Returns the directory that contains the application executable.
<p> For example, if you have installed TQt in the <tt>C:\Trolltech\TQt</tt>
directory, and you run the <tt>demo</tt> example, this function will
return "C:/Trolltech/TQt/examples/demo".
<p> On Mac OS X this will point to the directory actually containing the
executable, which may be inside of an application bundle (if the
application is bundled).
<p> <b>Warning:</b> On Unix, this function assumes that argv[0] contains the file
name of the executable (which it normally does). It also assumes that
the current directory hasn't been changed by the application.
<p> <p>See also <a href="#applicationFilePath">applicationFilePath</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="applicationFilePath"></a>TQApplication::applicationFilePath ()
</h3>
Returns the file path of the application executable.
<p> For example, if you have installed TQt in the <tt>C:\Trolltech\TQt</tt>
directory, and you run the <tt>demo</tt> example, this function will
return "C:/Trolltech/TQt/examples/demo/demo.exe".
<p> <b>Warning:</b> On Unix, this function assumes that argv[0] contains the file
name of the executable (which it normally does). It also assumes that
the current directory hasn't been changed by the application.
<p> <p>See also <a href="#applicationDirPath">applicationDirPath</a>().
<h3 class=fn>int <a name="argc"></a>TQApplication::argc () const
</h3>
<p> Returns the number of command line arguments.
<p> The documentation for <a href="#argv">argv</a>() describes how to process command line
arguments.
<p> <p>See also <a href="#argv">argv</a>() and <a href="#TQApplication">TQApplication::TQApplication</a>().
<p>Examples: <a href="tutorial2-04.html#x2557">chart/main.cpp</a> and <a href="scribble-example.html#x906">scribble/scribble.cpp</a>.
<h3 class=fn>char ** <a name="argv"></a>TQApplication::argv () const
</h3>
<p> Returns the command line argument vector.
<p> <tt>argv()[0]</tt> is the program name, <tt>argv()[1]</tt> is the first
argument and <tt>argv()[argc()-1]</tt> is the last argument.
<p> A TQApplication object is constructed by passing <em>argc</em> and <em>argv</em> from the <tt>main()</tt> function. Some of the arguments may be
recognized as TQt options and removed from the argument vector. For
example, the X11 version of TQt knows about <tt>-display</tt>, <tt>-font</tt>
and a few more options.
<p> Example:
<pre>
// showargs.cpp - displays program arguments in a list box
#include <<a href="qapplication-h.html">ntqapplication.h</a>>
#include <<a href="tqlistbox-h.html">tqlistbox.h</a>>
int main( int argc, char **argv )
{
TQApplication a( argc, argv );
<a href="tqlistbox.html">TQListBox</a> b;
a.<a href="#setMainWidget">setMainWidget</a>( &b );
for ( int i = 0; i < a.<a href="#argc">argc</a>(); i++ ) // a.<a href="#argc">argc</a>() == argc
b.<a href="tqlistbox.html#insertItem">insertItem</a>( a.<a href="#argv">argv</a>()[i] ); // a.<a href="#argv">argv</a>()[i] == argv[i]
b.<a href="tqwidget.html#show">show</a>();
return a.<a href="#exec">exec</a>();
}
</pre>
<p> If you run <tt>showargs -display unix:0 -font 9x15bold hello world</tt>
under X11, the list box contains the three strings "showargs",
"hello" and "world".
<p> TQt provides a global pointer, <tt>tqApp</tt>, that points to the
TQApplication object, and through which you can access <a href="#argc">argc</a>() and
<a href="#argv">argv</a>() in functions other than main().
<p> <p>See also <a href="#argc">argc</a>() and <a href="#TQApplication">TQApplication::TQApplication</a>().
<p>Examples: <a href="tutorial2-04.html#x2558">chart/main.cpp</a> and <a href="scribble-example.html#x907">scribble/scribble.cpp</a>.
<h3 class=fn>void <a name="beep"></a>TQApplication::beep ()<tt> [static]</tt>
</h3>
Sounds the bell, using the default volume and sound.
<h3 class=fn><a href="tqclipboard.html">TQClipboard</a> * <a name="clipboard"></a>TQApplication::clipboard ()<tt> [static]</tt>
</h3>
Returns a pointer to the application global clipboard.
<p>Examples: <a href="regexptester-example.html#x2468">regexptester/regexptester.cpp</a> and <a href="showimg-example.html#x1308">showimg/showimg.cpp</a>.
<h3 class=fn>void <a name="closeAllWindows"></a>TQApplication::closeAllWindows ()<tt> [slot]</tt>
</h3>
Closes all top-level windows.
<p> This function is particularly useful for applications with many
top-level windows. It could, for example, be connected to a "Quit"
entry in the file menu as shown in the following code example:
<p> <pre>
// the "Quit" menu entry should try to close all windows
<a href="tqpopupmenu.html">TQPopupMenu</a>* file = new <a href="tqpopupmenu.html">TQPopupMenu</a>( this );
file-><a href="tqmenudata.html#insertItem">insertItem</a>( "&Quit", tqApp, TQ_SLOT(<a href="#closeAllWindows">closeAllWindows</a>()), CTRL+Key_Q );
// when the last window is closed, the application should quit
<a href="tqobject.html#connect">connect</a>( tqApp, TQ_SIGNAL( <a href="#lastWindowClosed">lastWindowClosed</a>() ), tqApp, TQ_SLOT( <a href="#quit">quit</a>() ) );
</pre>
<p> The windows are closed in random order, until one window does not
accept the close event.
<p> <p>See also <a href="tqwidget.html#close">TQWidget::close</a>(), <a href="tqwidget.html#closeEvent">TQWidget::closeEvent</a>(), <a href="#lastWindowClosed">lastWindowClosed</a>(), <a href="#quit">quit</a>(), <a href="#topLevelWidgets">topLevelWidgets</a>(), and <a href="tqwidget.html#isTopLevel-prop">TQWidget::isTopLevel</a>.
<p>
<p>Examples: <a href="tqaction-application-example.html#x1127">action/application.cpp</a>, <a href="simple-application-example.html#x1544">application/application.cpp</a>, <a href="helpviewer-example.html#x980">helpviewer/helpwindow.cpp</a>, <a href="mdi-example.html#x2020">mdi/application.cpp</a>, and <a href="qwerty-example.html#x358">qwerty/qwerty.cpp</a>.
<h3 class=fn>bool <a name="closingDown"></a>TQApplication::closingDown ()<tt> [static]</tt>
</h3>
Returns TRUE if the application objects are being destroyed;
otherwise returns FALSE.
<p> <p>See also <a href="#startingUp">startingUp</a>().
<h3 class=fn>int <a name="colorSpec"></a>TQApplication::colorSpec ()<tt> [static]</tt>
</h3>
Returns the color specification.
<p>See also <a href="#setColorSpec">TQApplication::setColorSpec</a>().
<p>Example: <a href="showimg-example.html#x1309">showimg/showimg.cpp</a>.
<h3 class=fn>void <a name="commitData"></a>TQApplication::commitData ( <a href="tqsessionmanager.html">TQSessionManager</a> & sm )<tt> [virtual]</tt>
</h3>
<p> This function deals with <a href="session.html">session
management</a>. It is invoked when the <a href="tqsessionmanager.html">TQSessionManager</a> wants the
application to commit all its data.
<p> Usually this means saving all open files, after getting
permission from the user. Furthermore you may want to provide a means
by which the user can cancel the shutdown.
<p> Note that you should not exit the application within this function.
Instead, the session manager may or may not do this afterwards,
depending on the context.
<p> <b>Warning:</b> Within this function, no user interaction is possible, <em>unless</em> you ask the session manager <em>sm</em> for explicit permission.
See <a href="tqsessionmanager.html#allowsInteraction">TQSessionManager::allowsInteraction</a>() and
<a href="tqsessionmanager.html#allowsErrorInteraction">TQSessionManager::allowsErrorInteraction</a>() for details and example
usage.
<p> The default implementation requests interaction and sends a close
event to all visible top level widgets. If any event was
rejected, the shutdown is canceled.
<p> <p>See also <a href="#isSessionRestored">isSessionRestored</a>(), <a href="#sessionId">sessionId</a>(), <a href="#saveState">saveState</a>(), and <a href="session.html">the Session Management overview</a>.
<h3 class=fn>int <a name="cursorFlashTime"></a>TQApplication::cursorFlashTime ()<tt> [static]</tt>
</h3>
Returns the text cursor's flash (blink) time in milliseconds. The
flash time is the time required to display, invert and restore the
caret display.
<p> The default value on X11 is 1000 milliseconds. On Windows, the
control panel value is used.
<p> Widgets should not cache this value since it may be changed at any
time by the user changing the global desktop settings.
<p> <p>See also <a href="#setCursorFlashTime">setCursorFlashTime</a>().
<h3 class=fn><a href="tqtextcodec.html">TQTextCodec</a> * <a name="defaultCodec"></a>TQApplication::defaultCodec () const
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Returns <a href="tqtextcodec.html#codecForTr">TQTextCodec::codecForTr</a>().
<h3 class=fn><a href="tqdesktopwidget.html">TQDesktopWidget</a> * <a name="desktop"></a>TQApplication::desktop ()<tt> [static]</tt>
</h3>
Returns the desktop widget (also called the root window).
<p> The desktop widget is useful for obtaining the size of the screen.
It may also be possible to draw on the desktop. We recommend against
assuming that it's possible to draw on the desktop, since this does
not work on all operating systems.
<p> <pre>
<a href="tqdesktopwidget.html">TQDesktopWidget</a> *d = TQApplication::<a href="#desktop">desktop</a>();
int w = d-><a href="tqwidget.html#width">width</a>(); // returns desktop width
int h = d-><a href="tqwidget.html#height">height</a>(); // returns desktop height
</pre>
<p>Examples: <a href="canvas-example.html#x2958">canvas/main.cpp</a>, <a href="desktop-example.html#x1721">desktop/desktop.cpp</a>, <a href="helpviewer-example.html#x1037">helpviewer/main.cpp</a>, <a href="i18n-example.html#x1928">i18n/main.cpp</a>, <a href="qmag-example.html#x1765">qmag/qmag.cpp</a>, <a href="qwerty-example.html#x414">qwerty/main.cpp</a>, and <a href="scribble-example.html#x954">scribble/main.cpp</a>.
<h3 class=fn>bool <a name="desktopSettingsAware"></a>TQApplication::desktopSettingsAware ()<tt> [static]</tt>
</h3>
Returns the value set by <a href="#setDesktopSettingsAware">setDesktopSettingsAware</a>(); by default TRUE.
<p> <p>See also <a href="#setDesktopSettingsAware">setDesktopSettingsAware</a>().
<h3 class=fn>int <a name="doubleClickInterval"></a>TQApplication::doubleClickInterval ()<tt> [static]</tt>
</h3>
Returns the maximum duration for a double click.
<p> The default value on X11 is 400 milliseconds. On Windows, the
control panel value is used.
<p> <p>See also <a href="#setDoubleClickInterval">setDoubleClickInterval</a>().
<h3 class=fn>int <a name="enter_loop"></a>TQApplication::enter_loop ()
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> This function enters the main event loop (recursively). Do not call
it unless you really know what you are doing.
<p> Use <a href="#eventLoop">TQApplication::eventLoop</a>()->enterLoop() instead.
<p>
<h3 class=fn><a href="tqeventloop.html">TQEventLoop</a> * <a name="eventLoop"></a>TQApplication::eventLoop ()<tt> [static]</tt>
</h3>
Returns the application event loop. This function will return
zero if called during and after destroying TQApplication.
<p> To create your own instance of <a href="tqeventloop.html">TQEventLoop</a> or TQEventLoop subclass create
it before you create the TQApplication object.
<p> <p>See also <a href="tqeventloop.html">TQEventLoop</a>.
<p>Example: <a href="distributor-example.html#x2651">distributor/distributor.ui.h</a>.
<h3 class=fn>int <a name="exec"></a>TQApplication::exec ()
</h3>
Enters the main event loop and waits until <a href="#exit">exit</a>() is called or the
main widget is destroyed, and returns the value that was set to
exit() (which is 0 if exit() is called via <a href="#quit">quit</a>()).
<p> It is necessary to call this function to start event handling. The
main event loop receives events from the window system and
dispatches these to the application widgets.
<p> Generally speaking, no user interaction can take place before
calling <a href="#exec">exec</a>(). As a special case, modal widgets like <a href="ntqmessagebox.html">TQMessageBox</a>
can be used before calling exec(), because modal widgets call
exec() to start a local event loop.
<p> To make your application perform idle processing, i.e. executing a
special function whenever there are no pending events, use a
<a href="tqtimer.html">TQTimer</a> with 0 timeout. More advanced idle processing schemes can
be achieved using <a href="#processEvents">processEvents</a>().
<p> <p>See also <a href="#quit">quit</a>(), <a href="#exit">exit</a>(), <a href="#processEvents">processEvents</a>(), and <a href="#setMainWidget">setMainWidget</a>().
<p>Examples: <a href="helpsystem-example.html#x2700">helpsystem/main.cpp</a>, <a href="tqdialog.html#x2132">life/main.cpp</a>, <a href="archivesearch-example.html#x486">network/archivesearch/main.cpp</a>, <a href="ftpclient-example.html#x777">network/ftpclient/main.cpp</a>, <a href="tutorial1-01.html#x2283">t1/main.cpp</a>, and <a href="tutorial1-04.html#x2303">t4/main.cpp</a>.
<h3 class=fn>void <a name="exit"></a>TQApplication::exit ( int retcode = 0 )<tt> [static]</tt>
</h3>
Tells the application to exit with a return code.
<p> After this function has been called, the application leaves the main
event loop and returns from the call to <a href="#exec">exec</a>(). The exec() function
returns <em>retcode</em>.
<p> By convention, a <em>retcode</em> of 0 means success, and any non-zero
value indicates an error.
<p> Note that unlike the C library function of the same name, this
function <em>does</em> return to the caller -- it is event processing that
stops.
<p> <p>See also <a href="#quit">quit</a>() and <a href="#exec">exec</a>().
<p>Examples: <a href="canvas-chart-example.html#x2875">chart/chartform.cpp</a>, <a href="extension-dialog-example.html#x2865">extension/mainform.ui.h</a>, and <a href="picture-example.html#x106">picture/picture.cpp</a>.
<h3 class=fn>void <a name="exit_loop"></a>TQApplication::exit_loop ()
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> This function exits from a recursive call to the main event loop.
Do not call it unless you are an expert.
<p> Use <a href="#eventLoop">TQApplication::eventLoop</a>()->exitLoop() instead.
<p>
<h3 class=fn>void <a name="flush"></a>TQApplication::flush ()<tt> [static]</tt>
</h3>
Flushes the window system specific event queues.
<p> If you are doing graphical changes inside a loop that does not
return to the event loop on asynchronous window systems like X11
or double buffered window systems like MacOS X, and you want to
visualize these changes immediately (e.g. Splash Screens), call
this function.
<p> <p>See also <a href="#flushX">flushX</a>(), <a href="#sendPostedEvents">sendPostedEvents</a>(), and <a href="tqpainter.html#flush">TQPainter::flush</a>().
<h3 class=fn>void <a name="flushX"></a>TQApplication::flushX ()<tt> [static]</tt>
</h3>
Flushes the X event queue in the X11 implementation. This normally
returns almost immediately. Does nothing on other platforms.
<p> <p>See also <a href="#syncX">syncX</a>().
<p>Example: <a href="xform-example.html#x1217">xform/xform.cpp</a>.
<h3 class=fn><a href="tqwidget.html">TQWidget</a> * <a name="focusWidget"></a>TQApplication::focusWidget () const
</h3>
<p> Returns the application widget that has the keyboard input focus, or
0 if no widget in this application has the focus.
<p> <p>See also <a href="tqwidget.html#setFocus">TQWidget::setFocus</a>(), <a href="tqwidget.html#focus-prop">TQWidget::focus</a>, and <a href="#activeWindow">activeWindow</a>().
<h3 class=fn><a href="tqfont.html">TQFont</a> <a name="font"></a>TQApplication::font ( const <a href="tqwidget.html">TQWidget</a> * w = 0 )<tt> [static]</tt>
</h3>
Returns the default font for the widget <em>w</em>, or the default
application font if <em>w</em> is 0.
<p> <p>See also <a href="#setFont">setFont</a>(), <a href="#fontMetrics">fontMetrics</a>(), and <a href="tqwidget.html#font-prop">TQWidget::font</a>.
<p>Examples: <a href="qfd-example.html#x1979">qfd/fontdisplayer.cpp</a>, <a href="themes-example.html#x264">themes/metal.cpp</a>, and <a href="themes-example.html#x321">themes/themes.cpp</a>.
<h3 class=fn><a href="tqfontmetrics.html">TQFontMetrics</a> <a name="fontMetrics"></a>TQApplication::fontMetrics ()<tt> [static]</tt>
</h3>
Returns display (screen) font metrics for the application font.
<p> <p>See also <a href="#font">font</a>(), <a href="#setFont">setFont</a>(), <a href="tqwidget.html#fontMetrics">TQWidget::fontMetrics</a>(), and <a href="tqpainter.html#fontMetrics">TQPainter::fontMetrics</a>().
<h3 class=fn><a href="tqsize.html">TQSize</a> <a name="globalStrut"></a>TQApplication::globalStrut ()<tt> [static]</tt>
</h3>
<p> Returns the application's global strut.
<p> The strut is a size object whose dimensions are the minimum that any
GUI element that the user can interact with should have. For example
no button should be resized to be smaller than the global strut size.
<p> <p>See also <a href="#setGlobalStrut">setGlobalStrut</a>().
<h3 class=fn>void <a name="guiThreadAwake"></a>TQApplication::guiThreadAwake ()<tt> [signal]</tt>
</h3>
<p> This signal is emitted after the event loop returns from a function
that could block.
<p> <p>See also <a href="#wakeUpGuiThread">wakeUpGuiThread</a>().
<h3 class=fn>bool <a name="hasGlobalMouseTracking"></a>TQApplication::hasGlobalMouseTracking ()<tt> [static]</tt>
</h3>
<p> Returns TRUE if global mouse tracking is enabled; otherwise
returns FALSE.
<p> <p>See also <a href="#setGlobalMouseTracking">setGlobalMouseTracking</a>().
<h3 class=fn>bool <a name="hasPendingEvents"></a>TQApplication::hasPendingEvents ()
</h3>
This function returns TRUE if there are pending events; otherwise
returns FALSE. Pending events can be either from the window system
or posted events using <a href="#postEvent">TQApplication::postEvent</a>().
<h3 class=fn>int <a name="horizontalAlignment"></a>TQApplication::horizontalAlignment ( int align )<tt> [static]</tt>
</h3>
<p> Strips out vertical alignment flags and transforms an
alignment <em>align</em> of AlignAuto into AlignLeft or
AlignRight according to the language used. The other horizontal
alignment flags are left untouched.
<h3 class=fn>void <a name="installTranslator"></a>TQApplication::installTranslator ( <a href="tqtranslator.html">TQTranslator</a> * mf )
</h3>
Adds the message file <em>mf</em> to the list of message files to be used
for translations.
<p> Multiple message files can be installed. Translations are searched
for in the last installed message file, then the one from last, and
so on, back to the first installed message file. The search stops as
soon as a matching translation is found.
<p> <p>See also <a href="#removeTranslator">removeTranslator</a>(), <a href="#translate">translate</a>(), and <a href="tqtranslator.html#load">TQTranslator::load</a>().
<p>Example: <a href="i18n-example.html#x1930">i18n/main.cpp</a>.
<h3 class=fn>bool <a name="isEffectEnabled"></a>TQApplication::isEffectEnabled ( <a href="ntqt.html#UIEffect-enum">TQt::UIEffect</a> effect )<tt> [static]</tt>
</h3>
Returns TRUE if <em>effect</em> is enabled; otherwise returns FALSE.
<p> By default, TQt will try to use the desktop settings. Call
<a href="#setDesktopSettingsAware">setDesktopSettingsAware</a>(FALSE) to prevent this.
<p> Note: All effects are disabled on screens running at less than
16-bit color depth.
<p> <p>See also <a href="#setEffectEnabled">setEffectEnabled</a>() and <a href="ntqt.html#UIEffect-enum">TQt::UIEffect</a>.
<h3 class=fn>bool <a name="isSessionRestored"></a>TQApplication::isSessionRestored () const
</h3>
<p> Returns TRUE if the application has been restored from an earlier
<a href="session.html">session</a>; otherwise returns FALSE.
<p> <p>See also <a href="#sessionId">sessionId</a>(), <a href="#commitData">commitData</a>(), and <a href="#saveState">saveState</a>().
<h3 class=fn>void <a name="lastWindowClosed"></a>TQApplication::lastWindowClosed ()<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the user has closed the last
top level window.
<p> The signal is very useful when your application has many top level
widgets but no main widget. You can then connect it to the <a href="#quit">quit</a>()
slot.
<p> For convenience, this signal is <em>not</em> emitted for transient top level
widgets such as popup menus and dialogs.
<p> <p>See also <a href="#mainWidget">mainWidget</a>(), <a href="#topLevelWidgets">topLevelWidgets</a>(), <a href="tqwidget.html#isTopLevel-prop">TQWidget::isTopLevel</a>, and <a href="tqwidget.html#close">TQWidget::close</a>().
<p>Examples: <a href="addressbook-example.html#x608">addressbook/main.cpp</a>, <a href="extension-dialog-example.html#x2867">extension/main.cpp</a>, <a href="helpviewer-example.html#x1039">helpviewer/main.cpp</a>, <a href="mdi-example.html#x2096">mdi/main.cpp</a>, <a href="archivesearch-example.html#x487">network/archivesearch/main.cpp</a>, <a href="qwerty-example.html#x416">qwerty/main.cpp</a>, and <a href="regexptester-example.html#x2509">regexptester/main.cpp</a>.
<h3 class=fn><a href="tqstringlist.html">TQStringList</a> <a name="libraryPaths"></a>TQApplication::libraryPaths ()<tt> [static]</tt>
</h3>
Returns a list of paths that the application will search when
dynamically loading libraries.
The installation directory for plugins is the only entry if no
paths have been set. The default installation directory for plugins
is <tt>INSTALL/plugins</tt>, where <tt>INSTALL</tt> is the directory where TQt was
installed. The directory of the application executable (NOT the
working directory) is also added to the plugin paths.
<p> If you want to iterate over the list, you should iterate over a
copy, e.g.
<pre>
<a href="tqstringlist.html">TQStringList</a> list = app.libraryPaths();
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> See the <a href="plugins-howto.html">plugins documentation</a> for a
description of how the library paths are used.
<p> <p>See also <a href="#setLibraryPaths">setLibraryPaths</a>(), <a href="#addLibraryPath">addLibraryPath</a>(), <a href="#removeLibraryPath">removeLibraryPath</a>(), and <a href="ntqlibrary.html">TQLibrary</a>.
<h3 class=fn>void <a name="lock"></a>TQApplication::lock ()
</h3>
<p> Lock the TQt Library Mutex. If another thread has already locked the
mutex, the calling thread will block until the other thread has
unlocked the mutex.
<p> <p>See also <a href="#unlock">unlock</a>(), <a href="#locked">locked</a>(), and <a href="threads.html">Thread Support in TQt</a>.
<h3 class=fn>bool <a name="locked"></a>TQApplication::locked ()
</h3>
<p> Returns TRUE if the TQt Library Mutex is locked by a different thread;
otherwise returns FALSE.
<p> <b>Warning:</b> Due to different implementations of recursive mutexes on
the supported platforms, calling this function from the same thread
that previously locked the mutex will give undefined results.
<p> <p>See also <a href="#lock">lock</a>(), <a href="#unlock">unlock</a>(), and <a href="threads.html">Thread Support in TQt</a>.
<h3 class=fn>int <a name="loopLevel"></a>TQApplication::loopLevel () const
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Returns the current loop level.
<p> Use <a href="#eventLoop">TQApplication::eventLoop</a>()->loopLevel() instead.
<p>
<h3 class=fn>bool <a name="macEventFilter"></a>TQApplication::macEventFilter ( EventHandlerCallRef, EventRef )<tt> [virtual]</tt>
</h3>
This virtual function is only implemented under Macintosh.
<p> If you create an application that inherits TQApplication and
reimplement this function, you get direct access to all Carbon Events
that are received from the MacOS.
<p> Return TRUE if you want to stop the event from being processed.
Return FALSE for normal event dispatching.
<h3 class=fn><a href="tqwidget.html">TQWidget</a> * <a name="mainWidget"></a>TQApplication::mainWidget () const
</h3>
<p> Returns the main application widget, or 0 if there is no main
widget.
<p> <p>See also <a href="#setMainWidget">setMainWidget</a>().
<h3 class=fn>bool <a name="notify"></a>TQApplication::notify ( <a href="tqobject.html">TQObject</a> * receiver, <a href="tqevent.html">TQEvent</a> * e )<tt> [virtual]</tt>
</h3>
Sends event <em>e</em> to <em>receiver</em>: <em>receiver</em>->event(<em>e</em>).
Returns the value that is returned from the receiver's event handler.
<p> For certain types of events (e.g. mouse and key events),
the event will be propagated to the receiver's parent and so on up to
the top-level object if the receiver is not interested in the event
(i.e., it returns FALSE).
<p> There are five different ways that events can be processed;
reimplementing this virtual function is just one of them. All five
approaches are listed below:
<ol type=1>
<li> Reimplementing this function. This is very powerful, providing
complete control; but only one subclass can be tqApp.
<p> <li> Installing an event filter on tqApp. Such an event filter is able
to process all events for all widgets, so it's just as powerful as
reimplementing <a href="#notify">notify</a>(); furthermore, it's possible to have more
than one application-global event filter. Global event filters even
see mouse events for <a href="tqwidget.html#isEnabled">disabled
widgets,</a> and if <a href="#setGlobalMouseTracking">global mouse
tracking</a> is enabled, as well as mouse move events for all
widgets.
<p> <li> Reimplementing <a href="tqobject.html#event">TQObject::event</a>() (as <a href="tqwidget.html">TQWidget</a> does). If you do
this you get Tab key presses, and you get to see the events before
any widget-specific event filters.
<p> <li> Installing an event filter on the object. Such an event filter
gets all the events except Tab and Shift-Tab key presses.
<p> <li> Reimplementing paintEvent(), mousePressEvent() and so
on. This is the commonest, easiest and least powerful way.
</ol>
<p> <p>See also <a href="tqobject.html#event">TQObject::event</a>() and <a href="tqobject.html#installEventFilter">installEventFilter</a>().
<h3 class=fn><a href="ntqcursor.html">TQCursor</a> * <a name="overrideCursor"></a>TQApplication::overrideCursor ()<tt> [static]</tt>
</h3>
<p> Returns the active application override cursor.
<p> This function returns 0 if no application cursor has been defined
(i.e. the internal cursor stack is empty).
<p> <p>See also <a href="#setOverrideCursor">setOverrideCursor</a>() and <a href="#restoreOverrideCursor">restoreOverrideCursor</a>().
<h3 class=fn><a href="tqpalette.html">TQPalette</a> <a name="palette"></a>TQApplication::palette ( const <a href="tqwidget.html">TQWidget</a> * w = 0 )<tt> [static]</tt>
</h3>
Returns the application palette.
<p> If a widget is passed in <em>w</em>, the default palette for the
widget's class is returned. This may or may not be the application
palette. In most cases there isn't a special palette for certain
types of widgets, but one notable exception is the popup menu under
Windows, if the user has defined a special background color for
menus in the display settings.
<p> <p>See also <a href="#setPalette">setPalette</a>() and <a href="tqwidget.html#palette-prop">TQWidget::palette</a>.
<p>Examples: <a href="desktop-example.html#x1723">desktop/desktop.cpp</a>, <a href="themes-example.html#x265">themes/metal.cpp</a>, and <a href="themes-example.html#x186">themes/wood.cpp</a>.
<h3 class=fn>void <a name="polish"></a>TQApplication::polish ( <a href="tqwidget.html">TQWidget</a> * w )<tt> [virtual]</tt>
</h3>
Initialization of the appearance of the widget <em>w</em> <em>before</em> it is first
shown.
<p> Usually widgets call this automatically when they are polished. It
may be used to do some style-based central customization of widgets.
<p> Note that you are not limited to the public functions of <a href="tqwidget.html">TQWidget</a>.
Instead, based on meta information like <a href="tqobject.html#className">TQObject::className</a>() you are
able to customize any kind of widget.
<p> <p>See also <a href="tqstyle.html#polish">TQStyle::polish</a>(), <a href="tqwidget.html#polish">TQWidget::polish</a>(), <a href="#setPalette">setPalette</a>(), and <a href="#setFont">setFont</a>().
<h3 class=fn>void <a name="postEvent"></a>TQApplication::postEvent ( <a href="tqobject.html">TQObject</a> * receiver, <a href="tqevent.html">TQEvent</a> * event )<tt> [static]</tt>
</h3><p><b>Note:</b> This function is <a href="threads.html#threadsafe">thread-safe</a> when TQt is built withthread support.</p>
Adds the event <em>event</em> with the object <em>receiver</em> as the receiver of the
event, to an event queue and returns immediately.
<p> The event must be allocated on the heap since the post event queue
will take ownership of the event and delete it once it has been posted.
<p> When control returns to the main event loop, all events that are
stored in the queue will be sent using the <a href="#notify">notify</a>() function.
<p>
<p> <p>See also <a href="#sendEvent">sendEvent</a>() and <a href="#notify">notify</a>().
<h3 class=fn>void <a name="processEvents"></a>TQApplication::processEvents ()
</h3>
Processes pending events, for 3 seconds or until there are no more
events to process, whichever is shorter.
<p> You can call this function occasionally when your program is busy
performing a long operation (e.g. copying a file).
<p> <p>See also <a href="#exec">exec</a>(), <a href="tqtimer.html">TQTimer</a>, and <a href="tqeventloop.html#processEvents">TQEventLoop::processEvents</a>().
<p>Examples: <a href="fileiconview-example.html#x808">fileiconview/tqfileiconview.cpp</a> and <a href="ftpclient-example.html#x778">network/ftpclient/main.cpp</a>.
<h3 class=fn>void <a name="processEvents-2"></a>TQApplication::processEvents ( int maxtime )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Processes pending events for <em>maxtime</em> milliseconds or until
there are no more events to process, whichever is shorter.
<p> You can call this function occasionally when you program is busy
doing a long operation (e.g. copying a file).
<p> <p>See also <a href="#exec">exec</a>(), <a href="tqtimer.html">TQTimer</a>, and <a href="tqeventloop.html#processEvents">TQEventLoop::processEvents</a>().
<h3 class=fn>void <a name="processOneEvent"></a>TQApplication::processOneEvent ()
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Waits for an event to occur, processes it, then returns.
<p> This function is useful for adapting TQt to situations where the
event processing must be grafted onto existing program loops.
<p> Using this function in new applications may be an indication of design
problems.
<p> <p>See also <a href="#processEvents">processEvents</a>(), <a href="#exec">exec</a>(), and <a href="tqtimer.html">TQTimer</a>.
<h3 class=fn>void <a name="quit"></a>TQApplication::quit ()<tt> [slot]</tt>
</h3>
Tells the application to exit with return code 0 (success).
Equivalent to calling <a href="#exit">TQApplication::exit</a>( 0 ).
<p> It's common to connect the <a href="#lastWindowClosed">lastWindowClosed</a>() signal to <a href="#quit">quit</a>(), and
you also often connect e.g. <a href="tqbutton.html#clicked">TQButton::clicked</a>() or signals in
<a href="tqaction.html">TQAction</a>, <a href="tqpopupmenu.html">TQPopupMenu</a> or <a href="tqmenubar.html">TQMenuBar</a> to it.
<p> Example:
<pre>
<a href="tqpushbutton.html">TQPushButton</a> *quitButton = new <a href="tqpushbutton.html">TQPushButton</a>( "Quit" );
<a href="tqobject.html#connect">connect</a>( quitButton, TQ_SIGNAL(<a href="tqbutton.html#clicked">clicked</a>()), tqApp, TQ_SLOT(<a href="#quit">quit</a>()) );
</pre>
<p> <p>See also <a href="#exit">exit</a>(), <a href="#aboutToQuit">aboutToQuit</a>(), <a href="#lastWindowClosed">lastWindowClosed</a>(), and <a href="tqaction.html">TQAction</a>.
<p>Examples: <a href="addressbook-example.html#x609">addressbook/main.cpp</a>, <a href="mdi-example.html#x2097">mdi/main.cpp</a>, <a href="archivesearch-example.html#x488">network/archivesearch/main.cpp</a>, <a href="regexptester-example.html#x2510">regexptester/main.cpp</a>, <a href="tutorial1-02.html#x2288">t2/main.cpp</a>, <a href="tutorial1-04.html#x2304">t4/main.cpp</a>, and <a href="tutorial1-06.html#x2321">t6/main.cpp</a>.
<h3 class=fn>void <a name="removeLibraryPath"></a>TQApplication::removeLibraryPath ( const <a href="tqstring.html">TQString</a> & path )<tt> [static]</tt>
</h3>
Removes <em>path</em> from the library path list. If <em>path</em> is empty or not
in the path list, the list is not changed.
<p> <p>See also <a href="#addLibraryPath">addLibraryPath</a>(), <a href="#libraryPaths">libraryPaths</a>(), and <a href="#setLibraryPaths">setLibraryPaths</a>().
<h3 class=fn>void <a name="removePostedEvents"></a>TQApplication::removePostedEvents ( <a href="tqobject.html">TQObject</a> * receiver )<tt> [static]</tt>
</h3><p><b>Note:</b> This function is <a href="threads.html#threadsafe">thread-safe</a> when TQt is built withthread support.</p>
Removes all events posted using <a href="#postEvent">postEvent</a>() for <em>receiver</em>.
<p> The events are <em>not</em> dispatched, instead they are removed from the
queue. You should never need to call this function. If you do call it,
be aware that killing events may cause <em>receiver</em> to break one or
more invariants.
<p>
<h3 class=fn>void <a name="removeTranslator"></a>TQApplication::removeTranslator ( <a href="tqtranslator.html">TQTranslator</a> * mf )
</h3>
Removes the message file <em>mf</em> from the list of message files used by
this application. (It does not delete the message file from the file
system.)
<p> <p>See also <a href="#installTranslator">installTranslator</a>(), <a href="#translate">translate</a>(), and <a href="tqobject.html#tr">TQObject::tr</a>().
<p>Example: <a href="i18n-example.html#x1932">i18n/main.cpp</a>.
<h3 class=fn>void <a name="restoreOverrideCursor"></a>TQApplication::restoreOverrideCursor ()<tt> [static]</tt>
</h3>
Undoes the last <a href="#setOverrideCursor">setOverrideCursor</a>().
<p> If setOverrideCursor() has been called twice, calling
<a href="#restoreOverrideCursor">restoreOverrideCursor</a>() will activate the first cursor set.
Calling this function a second time restores the original widgets'
cursors.
<p> <p>See also <a href="#setOverrideCursor">setOverrideCursor</a>() and <a href="#overrideCursor">overrideCursor</a>().
<p>Examples: <a href="distributor-example.html#x2652">distributor/distributor.ui.h</a>, <a href="archivesearch-example.html#x473">network/archivesearch/archivedialog.ui.h</a>, <a href="ftpclient-example.html#x737">network/ftpclient/ftpmainwindow.ui.h</a>, and <a href="showimg-example.html#x1311">showimg/showimg.cpp</a>.
<h3 class=fn>bool <a name="reverseLayout"></a>TQApplication::reverseLayout ()<tt> [static]</tt>
</h3>
Returns TRUE if all dialogs and widgets will be laid out in a
mirrored (right to left) fashion. Returns FALSE if dialogs and
widgets will be laid out left to right.
<p> <p>See also <a href="#setReverseLayout">setReverseLayout</a>().
<h3 class=fn>void <a name="saveState"></a>TQApplication::saveState ( <a href="tqsessionmanager.html">TQSessionManager</a> & sm )<tt> [virtual]</tt>
</h3>
<p> This function deals with <a href="session.html">session
management</a>. It is invoked when the
<a href="tqsessionmanager.html">session manager</a> wants the application
to preserve its state for a future session.
<p> For example, a text editor would create a temporary file that
includes the current contents of its edit buffers, the location of
the cursor and other aspects of the current editing session.
<p> Note that you should never exit the application within this
function. Instead, the session manager may or may not do this
afterwards, depending on the context. Futhermore, most session
managers will very likely request a saved state immediately after
the application has been started. This permits the session manager
to learn about the application's restart policy.
<p> <b>Warning:</b> Within this function, no user interaction is possible, <em>unless</em> you ask the session manager <em>sm</em> for explicit permission.
See <a href="tqsessionmanager.html#allowsInteraction">TQSessionManager::allowsInteraction</a>() and
<a href="tqsessionmanager.html#allowsErrorInteraction">TQSessionManager::allowsErrorInteraction</a>() for details.
<p> <p>See also <a href="#isSessionRestored">isSessionRestored</a>(), <a href="#sessionId">sessionId</a>(), <a href="#commitData">commitData</a>(), and <a href="session.html">the Session Management overview</a>.
<h3 class=fn>bool <a name="sendEvent"></a>TQApplication::sendEvent ( <a href="tqobject.html">TQObject</a> * receiver, <a href="tqevent.html">TQEvent</a> * event )<tt> [static]</tt>
</h3>
<p> Sends event <em>event</em> directly to receiver <em>receiver</em>, using the
<a href="#notify">notify</a>() function. Returns the value that was returned from the event
handler.
<p> The event is <em>not</em> deleted when the event has been sent. The normal
approach is to create the event on the stack, e.g.
<pre>
<a href="qmouseevent.html">TQMouseEvent</a> me( TQEvent::MouseButtonPress, pos, 0, 0 );
TQApplication::<a href="#sendEvent">sendEvent</a>( mainWindow, &me );
</pre>
If you create the event on the heap you must delete it.
<p> <p>See also <a href="#postEvent">postEvent</a>() and <a href="#notify">notify</a>().
<p>Example: <a href="popup-example.html#x1602">popup/popup.cpp</a>.
<h3 class=fn>void <a name="sendPostedEvents"></a>TQApplication::sendPostedEvents ( <a href="tqobject.html">TQObject</a> * receiver, int event_type )<tt> [static]</tt>
</h3>
Immediately dispatches all events which have been previously queued
with <a href="#postEvent">TQApplication::postEvent</a>() and which are for the object <em>receiver</em>
and have the event type <em>event_type</em>.
<p> Note that events from the window system are <em>not</em> dispatched by this
function, but by <a href="#processEvents">processEvents</a>().
<p> If <em>receiver</em> is null, the events of <em>event_type</em> are sent for all
objects. If <em>event_type</em> is 0, all the events are sent for <em>receiver</em>.
<h3 class=fn>void <a name="sendPostedEvents-2"></a>TQApplication::sendPostedEvents ()<tt> [static]</tt>
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Dispatches all posted events, i.e. empties the event queue.
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="sessionId"></a>TQApplication::sessionId () const
</h3>
<p> Returns the current <a href="session.html">session's</a> identifier.
<p> If the application has been restored from an earlier session, this
identifier is the same as it was in that previous session.
<p> The session identifier is guaranteed to be unique both for different
applications and for different instances of the same application.
<p> <p>See also <a href="#isSessionRestored">isSessionRestored</a>(), <a href="#sessionKey">sessionKey</a>(), <a href="#commitData">commitData</a>(), and <a href="#saveState">saveState</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="sessionKey"></a>TQApplication::sessionKey () const
</h3>
<p> Returns the session key in the current <a href="session.html">session</a>.
<p> If the application has been restored from an earlier session, this
key is the same as it was when the previous session ended.
<p> The session key changes with every call of <a href="#commitData">commitData</a>() or
<a href="#saveState">saveState</a>().
<p> <p>See also <a href="#isSessionRestored">isSessionRestored</a>(), <a href="#sessionId">sessionId</a>(), <a href="#commitData">commitData</a>(), and <a href="#saveState">saveState</a>().
<h3 class=fn>void <a name="setColorSpec"></a>TQApplication::setColorSpec ( int spec )<tt> [static]</tt>
</h3>
Sets the color specification for the application to <em>spec</em>.
<p> The color specification controls how the application allocates colors
when run on a display with a limited amount of colors, e.g. 8 bit / 256
color displays.
<p> The color specification must be set before you create the TQApplication
object.
<p> The options are:
<ul>
<li> TQApplication::NormalColor.
This is the default color allocation strategy. Use this option if
your application uses buttons, menus, texts and pixmaps with few
colors. With this option, the application uses system global
colors. This works fine for most applications under X11, but on
Windows machines it may cause dithering of non-standard colors.
<li> TQApplication::CustomColor.
Use this option if your application needs a small number of custom
colors. On X11, this option is the same as NormalColor. On Windows, TQt
creates a Windows palette, and allocates colors to it on demand.
<li> TQApplication::ManyColor.
Use this option if your application is very color hungry
(e.g. it requires thousands of colors).
Under X11 the effect is:
<ul>
<li> For 256-color displays which have at best a 256 color true color
visual, the default visual is used, and colors are allocated
from a color cube. The color cube is the 6x6x6 (216 color) "Web
palette"<sup>*</sup>, but the number of colors can be changed
by the <em>-ncols</em> option. The user can force the application to
use the true color visual with the <a href="#TQApplication">-visual</a> option.
<li> For 256-color displays which have a true color visual with more
than 256 colors, use that visual. Silicon Graphics X servers
have this feature, for example. They provide an 8 bit visual
by default but can deliver true color when asked.
</ul>
On Windows, TQt creates a Windows palette, and fills it with a color cube.
</ul>
<p> Be aware that the CustomColor and ManyColor choices may lead to colormap
flashing: The foreground application gets (most) of the available
colors, while the background windows will look less attractive.
<p> Example:
<pre>
int main( int argc, char **argv )
{
TQApplication::<a href="#setColorSpec">setColorSpec</a>( TQApplication::<a href="#ColorSpec-enum">ManyColor</a> );
TQApplication a( argc, argv );
...
}
</pre>
<p> <a href="tqcolor.html">TQColor</a> provides more functionality for controlling color allocation and
freeing up certain colors. See <a href="tqcolor.html#enterAllocContext">TQColor::enterAllocContext</a>() for more
information.
<p> To check what mode you end up with, call <a href="tqcolor.html#numBitPlanes">TQColor::numBitPlanes</a>() once
the TQApplication object exists. A value greater than 8 (typically
16, 24 or 32) means true color.
<p> <sup>*</sup> The color cube used by TQt has 216 colors whose red,
green, and blue components always have one of the following values:
0x00, 0x33, 0x66, 0x99, 0xCC, or 0xFF.
<p> <p>See also <a href="#colorSpec">colorSpec</a>(), <a href="tqcolor.html#numBitPlanes">TQColor::numBitPlanes</a>(), and <a href="tqcolor.html#enterAllocContext">TQColor::enterAllocContext</a>().
<p>Examples: <a href="helpviewer-example.html#x1041">helpviewer/main.cpp</a>, <a href="showimg-example.html#x1361">showimg/main.cpp</a>, <a href="tutorial1-09.html#x2347">t9/main.cpp</a>, <a href="tetrix-example.html#x354">tetrix/tetrix.cpp</a>, and <a href="themes-example.html#x348">themes/main.cpp</a>.
<h3 class=fn>void <a name="setCursorFlashTime"></a>TQApplication::setCursorFlashTime ( int msecs )<tt> [static]</tt>
</h3>
Sets the text cursor's flash (blink) time to <em>msecs</em>
milliseconds. The flash time is the time required to display,
invert and restore the caret display. Usually the text cursor is
displayed for <em>msecs/2</em> milliseconds, then hidden for <em>msecs/2</em>
milliseconds, but this may vary.
<p> Note that on Microsoft Windows, calling this function sets the
cursor flash time for all windows.
<p> <p>See also <a href="#cursorFlashTime">cursorFlashTime</a>().
<h3 class=fn>void <a name="setDefaultCodec"></a>TQApplication::setDefaultCodec ( <a href="tqtextcodec.html">TQTextCodec</a> * codec )
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> This is the same as <a href="tqtextcodec.html#setCodecForTr">TQTextCodec::setCodecForTr</a>().
<h3 class=fn>void <a name="setDesktopSettingsAware"></a>TQApplication::setDesktopSettingsAware ( bool on )<tt> [static]</tt>
</h3>
By default, TQt will try to use the current standard colors, fonts
etc., from the underlying window system's desktop settings,
and use them for all relevant widgets. This behavior can be switched off
by calling this function with <em>on</em> set to FALSE.
<p> This static function must be called before creating the TQApplication
object, like this:
<p> <pre>
int main( int argc, char** argv ) {
TQApplication::<a href="#setDesktopSettingsAware">setDesktopSettingsAware</a>( FALSE ); // I know better than the user
TQApplication myApp( argc, argv ); // Use default fonts & colors
...
}
</pre>
<p> <p>See also <a href="#desktopSettingsAware">desktopSettingsAware</a>().
<h3 class=fn>void <a name="setDoubleClickInterval"></a>TQApplication::setDoubleClickInterval ( int ms )<tt> [static]</tt>
</h3>
Sets the time limit that distinguishes a double click from two
consecutive mouse clicks to <em>ms</em> milliseconds.
<p> Note that on Microsoft Windows, calling this function sets the
double click interval for all windows.
<p> <p>See also <a href="#doubleClickInterval">doubleClickInterval</a>().
<h3 class=fn>void <a name="setEffectEnabled"></a>TQApplication::setEffectEnabled ( <a href="ntqt.html#UIEffect-enum">TQt::UIEffect</a> effect, bool enable = TRUE )<tt> [static]</tt>
</h3>
Enables the UI effect <em>effect</em> if <em>enable</em> is TRUE, otherwise
the effect will not be used.
<p> Note: All effects are disabled on screens running at less than
16-bit color depth.
<p> <p>See also <a href="#isEffectEnabled">isEffectEnabled</a>(), <a href="ntqt.html#UIEffect-enum">TQt::UIEffect</a>, and <a href="#setDesktopSettingsAware">setDesktopSettingsAware</a>().
<h3 class=fn>void <a name="setFont"></a>TQApplication::setFont ( const <a href="tqfont.html">TQFont</a> & font, bool informWidgets = FALSE, const char * className = 0 )<tt> [static]</tt>
</h3> Changes the default application font to <em>font</em>. If <em>informWidgets</em> is TRUE, then existing widgets are informed about the
change and may adjust themselves to the new application
setting. If <em>informWidgets</em> is FALSE, the change only affects newly
created widgets. If <em>className</em> is passed, the change applies only
to classes that inherit <em>className</em> (as reported by
<a href="tqobject.html#inherits">TQObject::inherits</a>()).
<p> On application start-up, the default font depends on the window
system. It can vary depending on both the window system version and
the locale. This function lets you override the default font; but
overriding may be a bad idea because, for example, some locales need
extra-large fonts to support their special characters.
<p> <p>See also <a href="#font">font</a>(), <a href="#fontMetrics">fontMetrics</a>(), and <a href="tqwidget.html#font-prop">TQWidget::font</a>.
<p>Examples: <a href="desktop-example.html#x1724">desktop/desktop.cpp</a>, <a href="themes-example.html#x266">themes/metal.cpp</a>, and <a href="themes-example.html#x323">themes/themes.cpp</a>.
<h3 class=fn>void <a name="setGlobalMouseTracking"></a>TQApplication::setGlobalMouseTracking ( bool enable )<tt> [static]</tt>
</h3>
Enables global mouse tracking if <em>enable</em> is TRUE, or disables it
if <em>enable</em> is FALSE.
<p> Enabling global mouse tracking makes it possible for widget event
filters or application event filters to get all mouse move events,
even when no button is depressed. This is useful for special GUI
elements, e.g. tooltips.
<p> Global mouse tracking does not affect widgets and their
mouseMoveEvent(). For a widget to get mouse move events when no
button is depressed, it must do <a href="tqwidget.html#setMouseTracking">TQWidget::setMouseTracking</a>(TRUE).
<p> This function uses an internal counter. Each
<a href="#setGlobalMouseTracking">setGlobalMouseTracking</a>(TRUE) must have a corresponding
setGlobalMouseTracking(FALSE):
<pre>
// at this point global mouse tracking is off
TQApplication::<a href="#setGlobalMouseTracking">setGlobalMouseTracking</a>( TRUE );
TQApplication::<a href="#setGlobalMouseTracking">setGlobalMouseTracking</a>( TRUE );
TQApplication::<a href="#setGlobalMouseTracking">setGlobalMouseTracking</a>( FALSE );
// at this point it's still on
TQApplication::<a href="#setGlobalMouseTracking">setGlobalMouseTracking</a>( FALSE );
// but now it's off
</pre>
<p> <p>See also <a href="#hasGlobalMouseTracking">hasGlobalMouseTracking</a>() and <a href="tqwidget.html#mouseTracking-prop">TQWidget::mouseTracking</a>.
<h3 class=fn>void <a name="setGlobalStrut"></a>TQApplication::setGlobalStrut ( const <a href="tqsize.html">TQSize</a> & strut )<tt> [static]</tt>
</h3>
Sets the application's global strut to <em>strut</em>.
<p> The strut is a size object whose dimensions are the minimum that any
GUI element that the user can interact with should have. For example
no button should be resized to be smaller than the global strut size.
<p> The strut size should be considered when reimplementing GUI controls
that may be used on touch-screens or similar IO-devices.
<p> Example:
<pre>
TQSize& WidgetClass::sizeHint() const
{
return TQSize( 80, 25 ).expandedTo( TQApplication::<a href="#globalStrut">globalStrut</a>() );
}
</pre>
<p> <p>See also <a href="#globalStrut">globalStrut</a>().
<h3 class=fn>void <a name="setLibraryPaths"></a>TQApplication::setLibraryPaths ( const <a href="tqstringlist.html">TQStringList</a> & paths )<tt> [static]</tt>
</h3>
Sets the list of directories to search when loading libraries to <em>paths</em>.
All existing paths will be deleted and the path list will consist of the
paths given in <em>paths</em>.
<p> <p>See also <a href="#libraryPaths">libraryPaths</a>(), <a href="#addLibraryPath">addLibraryPath</a>(), <a href="#removeLibraryPath">removeLibraryPath</a>(), and <a href="ntqlibrary.html">TQLibrary</a>.
<h3 class=fn>void <a name="setMainWidget"></a>TQApplication::setMainWidget ( <a href="tqwidget.html">TQWidget</a> * mainWidget )<tt> [virtual]</tt>
</h3>
Sets the application's main widget to <em>mainWidget</em>.
<p> In most respects the main widget is like any other widget, except
that if it is closed, the application exits. Note that
TQApplication does <em>not</em> take ownership of the <em>mainWidget</em>, so
if you create your main widget on the heap you must delete it
yourself.
<p> You need not have a main widget; connecting <a href="#lastWindowClosed">lastWindowClosed</a>() to
<a href="#quit">quit</a>() is an alternative.
<p> For X11, this function also resizes and moves the main widget
according to the <em>-geometry</em> command-line option, so you should
set the default geometry (using <a href="tqwidget.html#setGeometry">TQWidget::setGeometry</a>()) before
calling <a href="#setMainWidget">setMainWidget</a>().
<p> <p>See also <a href="#mainWidget">mainWidget</a>(), <a href="#exec">exec</a>(), and <a href="#quit">quit</a>().
<p>Examples: <a href="tutorial2-04.html#x2560">chart/main.cpp</a>, <a href="helpsystem-example.html#x2701">helpsystem/main.cpp</a>, <a href="tqdialog.html#x2133">life/main.cpp</a>, <a href="ftpclient-example.html#x779">network/ftpclient/main.cpp</a>, <a href="tutorial1-01.html#x2284">t1/main.cpp</a>, and <a href="tutorial1-04.html#x2305">t4/main.cpp</a>.
<h3 class=fn>void <a name="setOverrideCursor"></a>TQApplication::setOverrideCursor ( const <a href="ntqcursor.html">TQCursor</a> & cursor, bool replace = FALSE )<tt> [static]</tt>
</h3>
Sets the application override cursor to <em>cursor</em>.
<p> Application override cursors are intended for showing the user
that the application is in a special state, for example during an
operation that might take some time.
<p> This cursor will be displayed in all the application's widgets
until <a href="#restoreOverrideCursor">restoreOverrideCursor</a>() or another <a href="#setOverrideCursor">setOverrideCursor</a>() is
called.
<p> Application cursors are stored on an internal stack.
setOverrideCursor() pushes the cursor onto the stack, and
restoreOverrideCursor() pops the active cursor off the stack.
Every setOverrideCursor() must eventually be followed by a
corresponding restoreOverrideCursor(), otherwise the stack will
never be emptied.
<p> If <em>replace</em> is TRUE, the new cursor will replace the last
override cursor (the stack keeps its depth). If <em>replace</em> is
FALSE, the new stack is pushed onto the top of the stack.
<p> Example:
<pre>
TQApplication::<a href="#setOverrideCursor">setOverrideCursor</a>( TQCursor(TQt::<a href="ntqt.html#CursorShape-enum">WaitCursor</a>) );
calculateHugeMandelbrot(); // lunch time...
TQApplication::<a href="#restoreOverrideCursor">restoreOverrideCursor</a>();
</pre>
<p> <p>See also <a href="#overrideCursor">overrideCursor</a>(), <a href="#restoreOverrideCursor">restoreOverrideCursor</a>(), and <a href="tqwidget.html#cursor-prop">TQWidget::cursor</a>.
<p>Examples: <a href="distributor-example.html#x2653">distributor/distributor.ui.h</a>, <a href="archivesearch-example.html#x474">network/archivesearch/archivedialog.ui.h</a>, <a href="ftpclient-example.html#x738">network/ftpclient/ftpmainwindow.ui.h</a>, and <a href="showimg-example.html#x1312">showimg/showimg.cpp</a>.
<h3 class=fn>void <a name="setPalette"></a>TQApplication::setPalette ( const <a href="tqpalette.html">TQPalette</a> & palette, bool informWidgets = FALSE, const char * className = 0 )<tt> [static]</tt>
</h3>
Changes the default application palette to <em>palette</em>. If <em>informWidgets</em> is TRUE, then existing widgets are informed about the
change and may adjust themselves to the new application
setting. If <em>informWidgets</em> is FALSE, the change only affects newly
created widgets.
<p> If <em>className</em> is passed, the change applies only to widgets that
inherit <em>className</em> (as reported by <a href="tqobject.html#inherits">TQObject::inherits</a>()). If
<em>className</em> is left 0, the change affects all widgets, thus overriding
any previously set class specific palettes.
<p> The palette may be changed according to the current GUI style in
<a href="tqstyle.html#polish">TQStyle::polish</a>().
<p> <p>See also <a href="tqwidget.html#palette-prop">TQWidget::palette</a>, <a href="#palette">palette</a>(), and <a href="tqstyle.html#polish">TQStyle::polish</a>().
<p>Examples: <a href="i18n-example.html#x1934">i18n/main.cpp</a>, <a href="themes-example.html#x267">themes/metal.cpp</a>, <a href="themes-example.html#x324">themes/themes.cpp</a>, and <a href="themes-example.html#x187">themes/wood.cpp</a>.
<h3 class=fn>void <a name="setReverseLayout"></a>TQApplication::setReverseLayout ( bool b )<tt> [static]</tt>
</h3>
If <em>b</em> is TRUE, all dialogs and widgets will be laid out in a
mirrored fashion, as required by right to left languages such as
Arabic and Hebrew. If <em>b</em> is FALSE, dialogs and widgets are laid
out left to right.
<p> Changing this flag in runtime does not cause a relayout of already
instantiated widgets.
<p> <p>See also <a href="#reverseLayout">reverseLayout</a>().
<h3 class=fn>void <a name="setStartDragDistance"></a>TQApplication::setStartDragDistance ( int l )<tt> [static]</tt>
</h3>
Sets the distance after which a drag should start to <em>l</em> pixels.
<p> <p>See also <a href="#startDragDistance">startDragDistance</a>().
<h3 class=fn>void <a name="setStartDragTime"></a>TQApplication::setStartDragTime ( int ms )<tt> [static]</tt>
</h3>
Sets the time after which a drag should start to <em>ms</em> ms.
<p> <p>See also <a href="#startDragTime">startDragTime</a>().
<h3 class=fn>void <a name="setStyle"></a>TQApplication::setStyle ( <a href="tqstyle.html">TQStyle</a> * style )<tt> [static]</tt>
</h3>
Sets the application's GUI style to <em>style</em>. Ownership of the style
object is transferred to TQApplication, so TQApplication will delete
the style object on application exit or when a new style is set.
<p> Example usage:
<pre>
TQApplication::<a href="#setStyle">setStyle</a>( new <a href="ntqwindowsstyle.html">TQWindowsStyle</a> );
</pre>
<p> When switching application styles, the color palette is set back to
the initial colors or the system defaults. This is necessary since
certain styles have to adapt the color palette to be fully
style-guide compliant.
<p> <p>See also <a href="#style">style</a>(), <a href="tqstyle.html">TQStyle</a>, <a href="#setPalette">setPalette</a>(), and <a href="#desktopSettingsAware">desktopSettingsAware</a>().
<p>Example: <a href="themes-example.html#x325">themes/themes.cpp</a>.
<h3 class=fn><a href="tqstyle.html">TQStyle</a> * <a name="setStyle-2"></a>TQApplication::setStyle ( const <a href="tqstring.html">TQString</a> & style )<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Requests a <a href="tqstyle.html">TQStyle</a> object for <em>style</em> from the <a href="tqstylefactory.html">TQStyleFactory</a>.
<p> The string must be one of the <a href="tqstylefactory.html#keys">TQStyleFactory::keys</a>(), typically one
of "windows", "motif", "cde", "motifplus", "platinum", "sgi" and
"compact". Depending on the platform, "windowsxp", "aqua" or
"macintosh" may be available.
<p> A later call to the TQApplication constructor will override the
requested style when a "-style" option is passed in as a commandline
parameter.
<p> Returns 0 if an unknown <em>style</em> is passed, otherwise the TQStyle object
returned is set as the application's GUI style.
<h3 class=fn>void <a name="setWheelScrollLines"></a>TQApplication::setWheelScrollLines ( int n )<tt> [static]</tt>
</h3>
Sets the number of lines to scroll when the mouse wheel is rotated
to <em>n</em>.
<p> If this number exceeds the number of visible lines in a certain
widget, the widget should interpret the scroll operation as a
single page up / page down operation instead.
<p> <p>See also <a href="#wheelScrollLines">wheelScrollLines</a>().
<h3 class=fn>void <a name="setWinStyleHighlightColor"></a>TQApplication::setWinStyleHighlightColor ( const <a href="tqcolor.html">TQColor</a> & c )<tt> [static]</tt>
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Sets the color used to mark selections in windows style for all widgets
in the application. Will repaint all widgets if the color is changed.
<p> The default color is <tt>darkBlue</tt>.
<p>See also <a href="#winStyleHighlightColor">winStyleHighlightColor</a>().
<h3 class=fn>int <a name="startDragDistance"></a>TQApplication::startDragDistance ()<tt> [static]</tt>
</h3>
If you support drag and drop in you application and a drag should
start after a mouse click and after moving the mouse a certain
distance, you should use the value which this method returns as the
distance.
<p> For example, if the mouse position of the click is stored in <tt>startPos</tt> and the current position (e.g. in the mouse move event) is
<tt>currPos</tt>, you can find out if a drag should be started with code
like this:
<pre>
if ( ( startPos - currPos ).manhattanLength() >
TQApplication::<a href="#startDragDistance">startDragDistance</a>() )
startTheDrag();
</pre>
<p> TQt uses this value internally, e.g. in <a href="tqfiledialog.html">TQFileDialog</a>.
<p> The default value is 4 pixels.
<p> <p>See also <a href="#setStartDragDistance">setStartDragDistance</a>(), <a href="#startDragTime">startDragTime</a>(), and <a href="tqpoint.html#manhattanLength">TQPoint::manhattanLength</a>().
<h3 class=fn>int <a name="startDragTime"></a>TQApplication::startDragTime ()<tt> [static]</tt>
</h3>
If you support drag and drop in you application and a drag should
start after a mouse click and after a certain time elapsed, you
should use the value which this method returns as the delay (in ms).
<p> TQt also uses this delay internally, e.g. in <a href="tqtextedit.html">TQTextEdit</a> and <a href="tqlineedit.html">TQLineEdit</a>,
for starting a drag.
<p> The default value is 500 ms.
<p> <p>See also <a href="#setStartDragTime">setStartDragTime</a>() and <a href="#startDragDistance">startDragDistance</a>().
<h3 class=fn>bool <a name="startingUp"></a>TQApplication::startingUp ()<tt> [static]</tt>
</h3>
Returns TRUE if an application object has not been created yet;
otherwise returns FALSE.
<p> <p>See also <a href="#closingDown">closingDown</a>().
<h3 class=fn><a href="tqstyle.html">TQStyle</a> & <a name="style"></a>TQApplication::style ()<tt> [static]</tt>
</h3>
Returns the application's style object.
<p> <p>See also <a href="#setStyle">setStyle</a>() and <a href="tqstyle.html">TQStyle</a>.
<h3 class=fn>void <a name="syncX"></a>TQApplication::syncX ()<tt> [static]</tt>
</h3>
Synchronizes with the X server in the X11 implementation. This
normally takes some time. Does nothing on other platforms.
<p> <p>See also <a href="#flushX">flushX</a>().
<h3 class=fn>TQWidgetList * <a name="topLevelWidgets"></a>TQApplication::topLevelWidgets ()<tt> [static]</tt>
</h3>
Returns a list of the top level widgets in the application.
<p> The list is created using <tt>new</tt> and must be deleted by the caller.
<p> The list is empty (<a href="tqptrlist.html#isEmpty">TQPtrList::isEmpty</a>()) if there are no top level
widgets.
<p> Note that some of the top level widgets may be hidden, for example
the tooltip if no tooltip is currently shown.
<p> Example:
<pre>
// Show all hidden top level widgets.
TQWidgetList *list = TQApplication::<a href="#topLevelWidgets">topLevelWidgets</a>();
TQWidgetListIt it( *list ); // iterate over the widgets
<a href="tqwidget.html">TQWidget</a> * w;
while ( (w=it.current()) != 0 ) { // for each top level widget...
++it;
if ( !w-><a href="tqwidget.html#isVisible">isVisible</a>() )
w-><a href="tqwidget.html#show">show</a>();
}
delete list; // delete the list, not the widgets
</pre>
<p> <b>Warning:</b> Delete the list as soon you have finished using it.
The widgets in the list may be deleted by someone else at any time.
<p> <p>See also <a href="#allWidgets">allWidgets</a>(), <a href="tqwidget.html#isTopLevel-prop">TQWidget::isTopLevel</a>, <a href="tqwidget.html#visible-prop">TQWidget::visible</a>, and <a href="tqptrlist.html#isEmpty">TQPtrList::isEmpty</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="translate"></a>TQApplication::translate ( const char * context, const char * sourceText, const char * comment = 0, <a href="ntqapplication.html#Encoding-enum">Encoding</a> encoding = DefaultCodec ) const
</h3><p><b>Note:</b> This function is <a href="threads.html#reentrant">reentrant</a> when TQt is built with thread support.</p>
Returns the translation text for <em>sourceText</em>, by querying the
installed messages files. The message files are searched from the most
recently installed message file back to the first installed message
file.
<p> <a href="tqobject.html#tr">TQObject::tr</a>() and <a href="tqobject.html#trUtf8">TQObject::trUtf8</a>() provide this functionality more
conveniently.
<p> <em>context</em> is typically a class name (e.g., "MyDialog") and
<em>sourceText</em> is either English text or a short identifying text, if
the output text will be very long (as for help texts).
<p> <em>comment</em> is a disambiguating comment, for when the same <em>sourceText</em> is used in different roles within the same context. By
default, it is null. <em>encoding</em> indicates the 8-bit encoding of
character stings
<p> See the <a href="tqtranslator.html">TQTranslator</a> documentation for more information about
contexts and comments.
<p> If none of the message files contain a translation for <em>sourceText</em> in <em>context</em>, this function returns a <a href="tqstring.html">TQString</a>
equivalent of <em>sourceText</em>. The encoding of <em>sourceText</em> is
specified by <em>encoding</em>; it defaults to <a href="#Encoding-enum">DefaultCodec</a>.
<p> This function is not virtual. You can use alternative translation
techniques by subclassing <a href="tqtranslator.html">TQTranslator</a>.
<p> <b>Warning:</b> This method is reentrant only if all translators are
installed <em>before</em> calling this method. Installing or removing
translators while performing translations is not supported. Doing
so will most likely result in crashes or other undesirable behavior.
<p> <p>See also <a href="tqobject.html#tr">TQObject::tr</a>(), <a href="#installTranslator">installTranslator</a>(), and <a href="#defaultCodec">defaultCodec</a>().
<h3 class=fn>bool <a name="tryLock"></a>TQApplication::tryLock ()
</h3>
<p> Attempts to lock the TQt Library Mutex, and returns immediately. If
the lock was obtained, this function returns TRUE. If another thread
has locked the mutex, this function returns FALSE, instead of
waiting for the lock to become available.
<p> The mutex must be unlocked with <a href="#unlock">unlock</a>() before another thread can
successfully lock it.
<p> <p>See also <a href="#lock">lock</a>(), <a href="#unlock">unlock</a>(), and <a href="threads.html">Thread Support in TQt</a>.
<h3 class=fn><a href="ntqapplication.html#Type-enum">Type</a> <a name="type"></a>TQApplication::type () const
</h3>
Returns the type of application, Tty, GuiClient or GuiServer.
<h3 class=fn>void <a name="unlock"></a>TQApplication::unlock ( bool wakeUpGui = TRUE )
</h3>
<p> Unlock the TQt Library Mutex. If <em>wakeUpGui</em> is TRUE (the default),
then the GUI thread will be woken with <a href="#wakeUpGuiThread">TQApplication::wakeUpGuiThread</a>().
<p> <p>See also <a href="#lock">lock</a>(), <a href="#locked">locked</a>(), and <a href="threads.html">Thread Support in TQt</a>.
<h3 class=fn>void <a name="wakeUpGuiThread"></a>TQApplication::wakeUpGuiThread ()
</h3>
<p> Wakes up the GUI thread.
<p> <p>See also <a href="#guiThreadAwake">guiThreadAwake</a>() and <a href="threads.html">Thread Support in TQt</a>.
<h3 class=fn>int <a name="wheelScrollLines"></a>TQApplication::wheelScrollLines ()<tt> [static]</tt>
</h3>
Returns the number of lines to scroll when the mouse wheel is
rotated.
<p> <p>See also <a href="#setWheelScrollLines">setWheelScrollLines</a>().
<h3 class=fn><a href="tqwidget.html">TQWidget</a> * <a name="widgetAt"></a>TQApplication::widgetAt ( int x, int y, bool child = FALSE )<tt> [static]</tt>
</h3>
Returns a pointer to the widget at global screen position <em>(x, y)</em>, or 0 if there is no TQt widget there.
<p> If <em>child</em> is FALSE and there is a child widget at position <em>(x, y)</em>, the top-level widget containing it is returned. If <em>child</em>
is TRUE the child widget at position <em>(x, y)</em> is returned.
<p> This function is normally rather slow.
<p> <p>See also <a href="ntqcursor.html#pos">TQCursor::pos</a>(), <a href="tqwidget.html#grabMouse">TQWidget::grabMouse</a>(), and <a href="tqwidget.html#grabKeyboard">TQWidget::grabKeyboard</a>().
<h3 class=fn><a href="tqwidget.html">TQWidget</a> * <a name="widgetAt-2"></a>TQApplication::widgetAt ( const <a href="tqpoint.html">TQPoint</a> & pos, bool child = FALSE )<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns a pointer to the widget at global screen position <em>pos</em>,
or 0 if there is no TQt widget there.
<p> If <em>child</em> is FALSE and there is a child widget at position <em>pos</em>, the top-level widget containing it is returned. If <em>child</em>
is TRUE the child widget at position <em>pos</em> is returned.
<h3 class=fn>bool <a name="winEventFilter"></a>TQApplication::winEventFilter ( MSG * )<tt> [virtual]</tt>
</h3>
This virtual function is only implemented under Windows.
<p> The message procedure calls this function for every message
received. Reimplement this function if you want to process window
messages that are not processed by TQt. If you don't want
the event to be processed by TQt, then return TRUE; otherwise
return FALSE.
<h3 class=fn>void <a name="winFocus"></a>TQApplication::winFocus ( <a href="tqwidget.html">TQWidget</a> * widget, bool gotFocus )
</h3>
This function is available only on Windows.
<p> If <em>gotFocus</em> is TRUE, <em>widget</em> will become the active window.
Otherwise the active window is reset to NULL.
<h3 class=fn>const <a href="tqcolor.html">TQColor</a> & <a name="winStyleHighlightColor"></a>TQApplication::winStyleHighlightColor ()<tt> [static]</tt>
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Returns the color used to mark selections in windows style.
<p> <p>See also <a href="#setWinStyleHighlightColor">setWinStyleHighlightColor</a>().
<h3 class=fn>bool <a name="x11EventFilter"></a>TQApplication::x11EventFilter ( XEvent * )<tt> [virtual]</tt>
</h3>
This virtual function is only implemented under X11.
<p> If you create an application that inherits TQApplication and
reimplement this function, you get direct access to all X events
that the are received from the X server.
<p> Return TRUE if you want to stop the event from being processed.
Return FALSE for normal event dispatching.
<p> <p>See also <a href="#x11ProcessEvent">x11ProcessEvent</a>().
<h3 class=fn>int <a name="x11ProcessEvent"></a>TQApplication::x11ProcessEvent ( XEvent * event )
</h3>
This function does the core processing of individual X
<em>event</em>s, normally by dispatching TQt events to the right
destination.
<p> It returns 1 if the event was consumed by special handling, 0 if
the <em>event</em> was consumed by normal handling, and -1 if the <em>event</em> was for an unrecognized widget.
<p> <p>See also <a href="#x11EventFilter">x11EventFilter</a>().
<hr><h2>Related Functions</h2>
<h3 class=fn>void <a name="Q_ASSERT"></a>Q_ASSERT ( bool test )
</h3>
<p>
<p> Prints a warning message containing the source code file name and
line number if <em>test</em> is FALSE.
<p> This is really a macro defined in <a href="qglobal-h.html">ntqglobal.h</a>.
<p> Q_ASSERT is useful for testing pre- and post-conditions.
<p> Example:
<pre>
//
// File: div.cpp
//
#include <<a href="qglobal-h.html">ntqglobal.h</a>>
int divide( int a, int b )
{
<a href="#Q_ASSERT">Q_ASSERT</a>( b != 0 ); // this is line 9
return a/b;
}
</pre>
<p> If <tt>b</tt> is zero, the Q_ASSERT statement will output the following
message using the <a href="#qWarning">tqWarning</a>() function:
<pre>
ASSERT: "b != 0" in div.cpp (9)
</pre>
<p> <p>See also <a href="#qWarning">tqWarning</a>() and <a href="debug.html">Debugging</a>.
<h3 class=fn>void <a name="TQ_CHECK_PTR"></a>TQ_CHECK_PTR ( void * p )
</h3>
<p>
<p> If <em>p</em> is 0, prints a warning message containing the source code file
name and line number, saying that the program ran out of memory.
<p> This is really a macro defined in <a href="qglobal-h.html">ntqglobal.h</a>.
<p> Example:
<pre>
int *a;
<a href="#TQ_CHECK_PTR">TQ_CHECK_PTR</a>( a = new int[80] ); // WRONG!
a = new (nothrow) int[80]; // Right
<a href="#TQ_CHECK_PTR">TQ_CHECK_PTR</a>( a );
</pre>
<p> <p>See also <a href="#qWarning">tqWarning</a>() and <a href="debug.html">Debugging</a>.
<h3 class=fn>void <a name="qAddPostRoutine"></a>tqAddPostRoutine ( TQtCleanUpFunction p )
</h3>
<p> Adds a global routine that will be called from the TQApplication
destructor. This function is normally used to add cleanup routines
for program-wide functionality.
<p> The function given by <em>p</em> should take no arguments and return
nothing, like this:
<pre>
static int *global_ptr = 0;
static void cleanup_ptr()
{
delete [] global_ptr;
global_ptr = 0;
}
void init_ptr()
{
global_ptr = new int[100]; // allocate data
<a href="#qAddPostRoutine">tqAddPostRoutine</a>( cleanup_ptr ); // delete later
}
</pre>
<p> Note that for an application- or module-wide cleanup,
<a href="#qAddPostRoutine">tqAddPostRoutine</a>() is often not suitable. People have a tendency to
make such modules dynamically loaded, and then unload those modules
long before the TQApplication destructor is called, for example.
<p> For modules and libraries, using a reference-counted initialization
manager or TQt' parent-child delete mechanism may be better. Here is
an example of a private class which uses the parent-child mechanism
to call a cleanup function at the right time:
<p> <pre>
class MyPrivateInitStuff: public <a href="tqobject.html">TQObject</a> {
private:
MyPrivateInitStuff( <a href="tqobject.html">TQObject</a> * parent ): <a href="tqobject.html">TQObject</a>( parent) {
// initialization goes here
}
MyPrivateInitStuff * p;
public:
static MyPrivateInitStuff * initStuff( <a href="tqobject.html">TQObject</a> * parent ) {
if ( !p )
p = new MyPrivateInitStuff( parent );
return p;
}
~MyPrivateInitStuff() {
// cleanup (the "post routine") goes here
}
}
</pre>
<p> By selecting the right parent widget/object, this can often be made
to clean up the module's data at the exact right moment.
<h3 class=fn>void <a name="qDebug"></a>tqDebug ( const char * msg, ... )
</h3>
<p>
<p> Prints a debug message <em>msg</em>, or calls the message handler (if it
has been installed).
<p> This function takes a format string and a list of arguments,
similar to the C printf() function.
<p> Example:
<pre>
<a href="#qDebug">tqDebug</a>( "my window handle = %x", myWidget->id() );
</pre>
<p> Under X11, the text is printed to stderr. Under Windows, the text
is sent to the debugger.
<p> <b>Warning:</b> The internal buffer is limited to 8196 bytes (including
the '\0'-terminator).
<p> <b>Warning:</b> Passing (const char *)0 as argument to tqDebug might lead
to crashes on certain platforms due to the platforms printf implementation.
<p> <p>See also <a href="#qWarning">tqWarning</a>(), <a href="#qFatal">tqFatal</a>(), <a href="#qInstallMsgHandler">qInstallMsgHandler</a>(), and <a href="debug.html">Debugging</a>.
<h3 class=fn>void <a name="qFatal"></a>tqFatal ( const char * msg, ... )
</h3>
<p>
<p> Prints a fatal error message <em>msg</em> and exits, or calls the
message handler (if it has been installed).
<p> This function takes a format string and a list of arguments,
similar to the C printf() function.
<p> Example:
<pre>
int divide( int a, int b )
{
if ( b == 0 ) // program error
<a href="#qFatal">tqFatal</a>( "divide: cannot divide by zero" );
return a/b;
}
</pre>
<p> Under X11, the text is printed to stderr. Under Windows, the text
is sent to the debugger.
<p> <b>Warning:</b> The internal buffer is limited to 8196 bytes (including
the '\0'-terminator).
<p> <b>Warning:</b> Passing (const char *)0 as argument to tqFatal might lead
to crashes on certain platforms due to the platforms printf implementation.
<p> <p>See also <a href="#qDebug">tqDebug</a>(), <a href="#qWarning">tqWarning</a>(), <a href="#qInstallMsgHandler">qInstallMsgHandler</a>(), and <a href="debug.html">Debugging</a>.
<h3 class=fn>TQtMsgHandler <a name="qInstallMsgHandler"></a>qInstallMsgHandler ( TQtMsgHandler h )
</h3>
<p> Installs a TQt message handler <em>h</em>. Returns a pointer to the
message handler previously defined.
<p> The message handler is a function that prints out debug messages,
warnings and fatal error messages. The TQt library (debug version)
contains hundreds of warning messages that are printed when
internal errors (usually invalid function arguments) occur. If you
implement your own message handler, you get total control of these
messages.
<p> The default message handler prints the message to the standard
output under X11 or to the debugger under Windows. If it is a
fatal message, the application aborts immediately.
<p> Only one message handler can be defined, since this is usually
done on an application-wide basis to control debug output.
<p> To restore the message handler, call <tt>qInstallMsgHandler(0)</tt>.
<p> Example:
<pre>
#include <<a href="qapplication-h.html">ntqapplication.h</a>>
#include <stdio.h>
#include <stdlib.h>
void myMessageOutput( TQtMsgType type, const char *msg )
{
switch ( type ) {
case TQtDebugMsg:
fprintf( stderr, "Debug: %s\n", msg );
break;
case TQtWarningMsg:
fprintf( stderr, "Warning: %s\n", msg );
break;
case TQtFatalMsg:
fprintf( stderr, "Fatal: %s\n", msg );
abort(); // deliberately core dump
}
}
int main( int argc, char **argv )
{
<a href="#qInstallMsgHandler">qInstallMsgHandler</a>( myMessageOutput );
TQApplication a( argc, argv );
...
return a.<a href="#exec">exec</a>();
}
</pre>
<p> <p>See also <a href="#qDebug">tqDebug</a>(), <a href="#qWarning">tqWarning</a>(), <a href="#qFatal">tqFatal</a>(), and <a href="debug.html">Debugging</a>.
<h3 class=fn>bool <a name="qSysInfo"></a>tqSysInfo ( int * wordSize, bool * bigEndian )
</h3>
<p> Obtains information about the system.
<p> The system's word size in bits (typically 32) is returned in <em>*wordSize</em>. The <em>*bigEndian</em> is set to TRUE if this is a big-endian
machine, or to FALSE if this is a little-endian machine.
<p> In debug mode, this function calls <a href="#qFatal">tqFatal</a>() with a message if the
computer is truly weird (i.e. different endianness for 16 bit and
32 bit integers); in release mode it returns FALSE.
<h3 class=fn>void <a name="qSystemWarning"></a>tqSystemWarning ( const char * msg, int code )
</h3>
<p> Prints the message <em>msg</em> and uses <em>code</em> to get a system specific
error message. When <em>code</em> is -1 (the default), the system's last
error code will be used if possible. Use this method to handle
failures in platform specific API calls.
<p> This function does nothing when TQt is built with <tt>TQT_NO_DEBUG</tt>
defined.
<h3 class=fn>const char * <a name="qVersion"></a>tqVersion ()
</h3>
<p> Returns the TQt version number as a string, for example, "2.3.0" or
"3.0.5".
<p> The <tt>TQT_VERSION</tt> define has the numeric value in the form:
0xmmiibb (m = major, i = minor, b = bugfix). For example, TQt
3.0.5's <tt>TQT_VERSION</tt> is 0x030005.
<h3 class=fn>void <a name="qWarning"></a>tqWarning ( const char * msg, ... )
</h3>
<p>
<p> Prints a warning message <em>msg</em>, or calls the message handler (if
it has been installed).
<p> This function takes a format string and a list of arguments,
similar to the C printf() function.
<p> Example:
<pre>
void f( int c )
{
if ( c > 200 )
<a href="#qWarning">tqWarning</a>( "f: bad argument, c == %d", c );
}
</pre>
<p> Under X11, the text is printed to stderr. Under Windows, the text
is sent to the debugger.
<p> <b>Warning:</b> The internal buffer is limited to 8196 bytes (including
the '\0'-terminator).
<p> <b>Warning:</b> Passing (const char *)0 as argument to tqWarning might lead
to crashes on certain platforms due to the platforms printf implementation.
<p> <p>See also <a href="#qDebug">tqDebug</a>(), <a href="#qFatal">tqFatal</a>(), <a href="#qInstallMsgHandler">qInstallMsgHandler</a>(), and <a href="debug.html">Debugging</a>.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright © 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 © 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>
|