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
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
|
// This is the SIP interface definition for TQObject.
//
// Copyright (c) 2007
// Riverbank Computing Limited <info@riverbankcomputing.co.uk>
//
// This file is part of PyTQt.
//
// This copy of PyTQt is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2, or (at your option) any later
// version.
//
// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
%ExportedDoc
<Sect2><Title>TQObject</Title>
<FuncSynopsis>
<FuncDef>bool <Function>disconnect</Function></FuncDef>
<ParamDef>const TQObject *<Parameter>receiver</Parameter></ParamDef>
<ParamDef>const char *<Parameter>member</Parameter> = 0</ParamDef>
</FuncSynopsis>
<Para>
Not yet implemented.
</Para>
<FuncSynopsis>
<FuncDef>bool <Function>disconnect</Function></FuncDef>
<ParamDef>const char *<Parameter>signal</Parameter> = 0</ParamDef>
<ParamDef>const TQObject *<Parameter>receiver</Parameter> = 0</ParamDef>
<ParamDef>const char *<Parameter>member</Parameter> = 0</ParamDef>
</FuncSynopsis>
<Para>
Not yet implemented.
</Para>
<FuncSynopsis>
<FuncDef>static bool <Function>disconnect</Function></FuncDef>
<ParamDef>const TQObject *<Parameter>sender</Parameter></ParamDef>
<ParamDef>const char *<Parameter>signal</Parameter></ParamDef>
<ParamDef>const TQObject *<Parameter>receiver</Parameter></ParamDef>
<ParamDef>const char *<Parameter>member</Parameter></ParamDef>
</FuncSynopsis>
<Para>
At the moment PyTQt does not support the full behaviour of the corresponding TQt
method. In particular, specifying None (ie. 0 in C++) for the
<Literal>signal</Literal> and <Literal>receiver</Literal> parameters is not yet
supported.
</Para>
</Sect2>
%End
%If (TQt_2_00 -)
class TQObject : TQt
{
%TypeHeaderCode
#include <tqobject.h>
#include <tqapplication.h>
%End
public:
TQObject(TQObject * /TransferThis/ = 0,const char * = 0);
%ConvertToSubClassCode
static struct class_graph {
const char *name;
sipWrapperType **type;
int yes, no;
} graph[] = {
{sipName_TQWidget, &sipClass_TQWidget, 25, 1},
#if TQT_VERSION >= 0x030100 && defined(SIP_FEATURE_TQt_ASSISTANTCLIENT)
{sipName_TQAssistantClient, &sipClass_TQAssistantClient, -1, 2},
#else
{NULL, NULL, -1, 2},
#endif
{sipName_TQSessionManager, &sipClass_TQSessionManager, -1, 3},
{sipName_TQTranslator, &sipClass_TQTranslator, -1, 4},
#if TQT_VERSION >= 0x030000
{sipName_TQProcess, &sipClass_TQProcess, -1, 5},
#else
{NULL, NULL, -1, 5},
#endif
{sipName_TQToolTipGroup, &sipClass_TQToolTipGroup, -1, 6},
#if defined(SIP_FEATURE_TQt_FILEDIALOG)
{sipName_TQFileIconProvider, &sipClass_TQFileIconProvider, -1, 7},
#else
{NULL, NULL, -1, 7},
#endif
#if TQT_VERSION >= 220 && defined(SIP_FEATURE_TQt_ACTION)
{sipName_TQAction, &sipClass_TQAction, 89, 8},
#else
{NULL, NULL, -1, 8},
#endif
#if TQT_VERSION >= 0x030000
{sipName_TQObjectCleanupHandler, &sipClass_TQObjectCleanupHandler, -1, 9},
#else
{NULL, NULL, -1, 9},
#endif
{sipName_TQTimer, &sipClass_TQTimer, -1, 10},
{sipName_TQLayout, &sipClass_TQLayout, 90, 11},
#if TQT_VERSION >= 210 && defined(SIP_FEATURE_TQt_NETWORKPROTOCOL)
{sipName_TQUrlOperator, &sipClass_TQUrlOperator, -1, 12},
#else
{NULL, NULL, -1, 12},
#endif
{sipName_TQStyleSheet, &sipClass_TQStyleSheet, -1, 13},
{sipName_TQValidator, &sipClass_TQValidator, 94, 14},
#if TQT_VERSION >= 210 && defined(SIP_FEATURE_TQt_NETWORKPROTOCOL)
{sipName_TQNetworkOperation, &sipClass_TQNetworkOperation, -1, 15},
#else
{NULL, NULL, -1, 15},
#endif
{sipName_TQAccel, &sipClass_TQAccel, -1, 16},
#if TQT_VERSION >= 0x030100
{sipName_TQEventLoop, &sipClass_TQEventLoop, -1, 17},
#else
{NULL, NULL, -1, 17},
#endif
#if TQT_VERSION >= 210 && defined(SIP_FEATURE_TQt_NETWORKPROTOCOL)
{sipName_TQNetworkProtocol, &sipClass_TQNetworkProtocol, -1, 18},
#else
{NULL, NULL, -1, 18},
#endif
#if TQT_VERSION >= 220 && defined(SIP_FEATURE_TQt_SOUND)
{sipName_TQSound, &sipClass_TQSound, -1, 19},
#else
{NULL, NULL, -1, 19},
#endif
{sipName_TQApplication, &sipClass_TQApplication, -1, 20},
{sipName_TQDragObject, &sipClass_TQDragObject, 97, 21},
{sipName_TQSocketNotifier, &sipClass_TQSocketNotifier, -1, 22},
{sipName_TQStyle, &sipClass_TQStyle, 103, 23},
{sipName_TQSignalMapper, &sipClass_TQSignalMapper, -1, 24},
#if defined(SIP_FEATURE_TQt_CLIPBOARD)
{sipName_TQClipboard, &sipClass_TQClipboard, -1, -1},
#else
{NULL, NULL, -1, -1},
#endif
{sipName_TQStatusBar, &sipClass_TQStatusBar, -1, 26},
#if defined(SIP_FEATURE_TQt_SIZEGRIP)
{sipName_TQSizeGrip, &sipClass_TQSizeGrip, -1, 27},
#else
{NULL, NULL, -1, 27},
#endif
{sipName_TQTabWidget, &sipClass_TQTabWidget, -1, 28},
#if TQT_VERSION >= 0x030000
{sipName_TQDateEdit, &sipClass_TQDateEdit, -1, 29},
#else
{NULL, NULL, -1, 29},
#endif
{sipName_TQMainWindow, &sipClass_TQMainWindow, -1, 30},
#if TQT_VERSION >= 0x030000
{sipName_TQDateTimeEdit, &sipClass_TQDateTimeEdit, -1, 31},
#else
{NULL, NULL, -1, 31},
#endif
#if TQT_VERSION >= 0x030000
{sipName_TQTimeEdit, &sipClass_TQTimeEdit, -1, 32},
#else
{NULL, NULL, -1, 32},
#endif
{sipName_TQFrame, &sipClass_TQFrame, 46, 33},
{sipName_TQScrollBar, &sipClass_TQScrollBar, -1, 34},
#if TQT_VERSION >= 220 && defined(SIP_FEATURE_TQt_DIAL)
{sipName_TQDial, &sipClass_TQDial, -1, 35},
#else
{NULL, NULL, -1, 35},
#endif
{sipName_TQButton, &sipClass_TQButton, 75, 36},
{sipName_TQTabBar, &sipClass_TQTabBar, -1, 37},
{sipName_TQDialog, &sipClass_TQDialog, 79, 38},
{sipName_TQComboBox, &sipClass_TQComboBox, -1, 39},
{sipName_TQHeader, &sipClass_TQHeader, -1, 40},
#if TQT_VERSION >= 0x030000
{sipName_TQDockArea, &sipClass_TQDockArea, -1, 41},
#else
{NULL, NULL, -1, 41},
#endif
#if TQT_VERSION >= 0x030200
{sipName_TQSplashScreen, &sipClass_TQSplashScreen, -1, 42},
#else
{NULL, NULL, -1, 42},
#endif
{sipName_TQSlider, &sipClass_TQSlider, -1, 43},
{sipName_TQSpinBox, &sipClass_TQSpinBox, -1, 44},
#if TQT_VERSION >= 210 && defined(SIP_FEATURE_TQt_WORKSPACE)
{sipName_TQWorkspace, &sipClass_TQWorkspace, -1, 45},
#else
{NULL, NULL, -1, 45},
#endif
#if TQT_VERSION >= 0x030000
{sipName_TQDesktopWidget, &sipClass_TQDesktopWidget, -1, -1},
#else
{NULL, NULL, -1, -1},
#endif
{sipName_TQGrid, &sipClass_TQGrid, -1, 47},
{sipName_TQLineEdit, &sipClass_TQLineEdit, -1, 48},
#if TQT_VERSION >= 0x030200
{sipName_TQToolBox, &sipClass_TQToolBox, -1, 49},
#else
{NULL, NULL, -1, 49},
#endif
{sipName_TQWidgetStack, &sipClass_TQWidgetStack, -1, 50},
#if TQT_VERSION >= 0x030000
{sipName_TQDockWindow, &sipClass_TQDockWindow, 60, 51},
#else
{NULL, NULL, -1, 51},
#endif
{sipName_TQMenuBar, &sipClass_TQMenuBar, -1, 52},
{sipName_TQLabel, &sipClass_TQLabel, -1, 53},
{sipName_TQGroupBox, &sipClass_TQGroupBox, 61, 54},
{sipName_TQPopupMenu, &sipClass_TQPopupMenu, -1, 55},
#if defined(SIP_FEATURE_TQt_SPLITTER)
{sipName_TQSplitter, &sipClass_TQSplitter, -1, 56},
#else
{NULL, NULL, -1, 56},
#endif
{sipName_TQProgressBar, &sipClass_TQProgressBar, -1, 57},
{sipName_TQScrollView, &sipClass_TQScrollView, 66, 58},
{sipName_TQHBox, &sipClass_TQHBox, 74, 59},
{sipName_TQLCDNumber, &sipClass_TQLCDNumber, -1, -1},
{sipName_TQToolBar, &sipClass_TQToolBar, -1, -1},
{sipName_TQButtonGroup, &sipClass_TQButtonGroup, 64, 62},
{sipName_TQHGroupBox, &sipClass_TQHGroupBox, -1, 63},
{sipName_TQVGroupBox, &sipClass_TQVGroupBox, -1, -1},
{sipName_TQVButtonGroup, &sipClass_TQVButtonGroup, -1, 65},
{sipName_TQHButtonGroup, &sipClass_TQHButtonGroup, -1, -1},
#if TQT_VERSION >= 210 && defined(SIP_FEATURE_TQt_ICONVIEW)
{sipName_TQIconView, &sipClass_TQIconView, -1, 67},
#else
{NULL, NULL, -1, 67},
#endif
{sipName_TQListView, &sipClass_TQListView, -1, 68},
{sipName_TQListBox, &sipClass_TQListBox, -1, 69},
#if TQT_VERSION >= 0x030000
{sipName_TQGridView, &sipClass_TQGridView, -1, 70},
#else
{NULL, NULL, -1, 70},
#endif
#if TQT_VERSION >= 0x030000
{sipName_TQTextEdit, &sipClass_TQTextEdit, 71, -1},
#else
{NULL, NULL, -1, -1},
#endif
{sipName_TQTextBrowser, &sipClass_TQTextBrowser, -1, 72},
{sipName_TQMultiLineEdit, &sipClass_TQMultiLineEdit, -1, 73},
{sipName_TQTextView, &sipClass_TQTextView, -1, -1},
{sipName_TQVBox, &sipClass_TQVBox, -1, -1},
{sipName_TQToolButton, &sipClass_TQToolButton, -1, 76},
{sipName_TQRadioButton, &sipClass_TQRadioButton, -1, 77},
{sipName_TQPushButton, &sipClass_TQPushButton, -1, 78},
{sipName_TQCheckBox, &sipClass_TQCheckBox, -1, -1},
#if defined(WS_X11) && defined(SIP_FEATURE_TQt_PRINTDIALOG)
{sipName_TQPrintDialog, &sipClass_TQPrintDialog, -1, 80},
#else
{NULL, NULL, -1, 80},
#endif
#if TQT_VERSION >= 0x030000
{sipName_TQErrorMessage, &sipClass_TQErrorMessage, -1, 81},
#else
{NULL, NULL, -1, 81},
#endif
#if TQT_VERSION >= 210 && defined(SIP_FEATURE_TQt_INPUTDIALOG)
{sipName_TQInputDialog, &sipClass_TQInputDialog, -1, 82},
#else
{NULL, NULL, -1, 82},
#endif
#if defined(SIP_FEATURE_TQt_MESSAGEBOX)
{sipName_TQMessageBox, &sipClass_TQMessageBox, -1, 83},
#else
{NULL, NULL, -1, 83},
#endif
#if defined(SIP_FEATURE_TQt_WIZARD)
{sipName_TQWizard, &sipClass_TQWizard, -1, 84},
#else
{NULL, NULL, -1, 84},
#endif
#if defined(SIP_FEATURE_TQt_COLORDIALOG)
{sipName_TQColorDialog, &sipClass_TQColorDialog, -1, 85},
#else
{NULL, NULL, -1, 85},
#endif
#if defined(SIP_FEATURE_TQt_FONTDIALOG)
{sipName_TQFontDialog, &sipClass_TQFontDialog, -1, 86},
#else
{NULL, NULL, -1, 86},
#endif
#if defined(SIP_FEATURE_TQt_FILEDIALOG)
{sipName_TQFileDialog, &sipClass_TQFileDialog, -1, 87},
#else
{NULL, NULL, -1, 87},
#endif
#if defined(SIP_FEATURE_TQt_PROGRESSDIALOG)
{sipName_TQProgressDialog, &sipClass_TQProgressDialog, -1, 88},
#else
{NULL, NULL, -1, 88},
#endif
#if defined(SIP_FEATURE_TQt_TABDIALOG)
{sipName_TQTabDialog, &sipClass_TQTabDialog, -1, -1},
#else
{NULL, NULL, -1, -1},
#endif
#if TQT_VERSION >= 220 && defined(SIP_FEATURE_TQt_ACTION)
{sipName_TQActionGroup, &sipClass_TQActionGroup, -1, -1},
#else
{NULL, NULL, -1, -1},
#endif
{sipName_TQGridLayout, &sipClass_TQGridLayout, -1, 91},
{sipName_TQBoxLayout, &sipClass_TQBoxLayout, 92, -1},
{sipName_TQHBoxLayout, &sipClass_TQHBoxLayout, -1, 93},
{sipName_TQVBoxLayout, &sipClass_TQVBoxLayout, -1, -1},
{sipName_TQDoubleValidator, &sipClass_TQDoubleValidator, -1, 95},
{sipName_TQIntValidator, &sipClass_TQIntValidator, -1, 96},
#if TQT_VERSION >= 0x030000
{sipName_TQRegExpValidator, &sipClass_TQRegExpValidator, -1, -1},
#else
{NULL, NULL, -1, -1},
#endif
{sipName_TQTextDrag, &sipClass_TQTextDrag, -1, 98},
{sipName_TQStoredDrag, &sipClass_TQStoredDrag, 101, 99},
#if TQT_VERSION >= 210 && defined(SIP_FEATURE_TQt_ICONVIEW) && defined(SIP_FEATURE_TQt_DRAGANDDROP)
{sipName_TQIconDrag, &sipClass_TQIconDrag, -1, 100},
#else
{NULL, NULL, -1, 100},
#endif
{sipName_TQImageDrag, &sipClass_TQImageDrag, -1, -1},
#if TQT_VERSION >= 210
{sipName_TQColorDrag, &sipClass_TQColorDrag, -1, 102},
#else
{NULL, NULL, -1, 102},
#endif
{sipName_TQUriDrag, &sipClass_TQUriDrag, -1, -1},
{sipName_TQCommonStyle, &sipClass_TQCommonStyle, 104, -1},
#if defined(SIP_FEATURE_TQt_STYLE_WINDOWS)
{sipName_TQWindowsStyle, &sipClass_TQWindowsStyle, 106, 105},
#else
{NULL, NULL, -1, 105},
#endif
#if defined(SIP_FEATURE_TQt_STYLE_MOTIF)
{sipName_TQMotifStyle, &sipClass_TQMotifStyle, 107, -1},
#else
{NULL, NULL, -1, -1},
#endif
#if defined(SIP_FEATURE_TQt_STYLE_PLATINUM)
{sipName_TQPlatinumStyle, &sipClass_TQPlatinumStyle, -1, 110},
#else
{NULL, NULL, -1, 110},
#endif
#if defined(SIP_FEATURE_TQt_STYLE_CDE)
{sipName_TQCDEStyle, &sipClass_TQCDEStyle, -1, 108},
#else
{NULL, NULL, -1, 108},
#endif
#if TQT_VERSION >= 220 && defined(SIP_FEATURE_TQt_STYLE_MOTIFPLUS)
{sipName_TQMotifPlusStyle, &sipClass_TQMotifPlusStyle, -1, 109},
#else
{NULL, NULL, -1, 109},
#endif
#if TQT_VERSION >= 220 && defined(SIP_FEATURE_TQt_STYLE_SGI)
{sipName_TQSGIStyle, &sipClass_TQSGIStyle, -1, -1},
#else
{NULL, NULL, -1, -1},
#endif
#if defined(PYQT_STYLE_WINDOWSXP)
{sipName_TQWindowsXPStyle, &sipClass_TQWindowsXPStyle, -1, -1},
#else
{NULL, NULL, -1, -1},
#endif
};
int i = 0;
sipClass = NULL;
do
{
struct class_graph *cg = &graph[i];
if (cg->name != NULL && sipCpp->inherits(cg->name))
{
sipClass = *cg->type;
i = cg->yes;
}
else
i = cg->no;
}
while (i >= 0);
%End
// This is really virtual. With the way we are implementing it doesn't
// need to be and has the advantage that the C++ implementation can be
// used in %ConvertToSubClassCode to get the C++ name for Python
// sub-classes. However, it is also means that C++ plugins can't get
// the true (Python) class name.
SIP_PYOBJECT className() const;
%MethodCode
sipRes = sipClassName(sipSelf);
%End
%If (- TQt_3_0_0)
static TQString tr(const char *) /AutoGen=TQt_TRANSLATION/;
%End
%If (TQt_2_2_0 - TQt_2_3_1)
// There was an apparent bug in moc prior to TQt v2.3.1 where this
// method wasn't automatically generated.
static TQString tr(const char *,const char *);
%End
%If (TQt_2_3_1 - TQt_3_0_0)
static TQString tr(const char *,const char *) /AutoGen=TQt_TRANSLATION/;
%End
%If (TQt_3_0_0 -)
// Note that tr() and trUtf8() are really static methods. We pretend
// they aren't so that we can use self to get hold of the class name.
// We could mimic moc's behaviour more accurately by creating tr() and
// trUtf8() methods for a Python sub-class instance in the sub-class's
// ctor.
TQString tr(const char *,const char * = 0);
%MethodCode
PyObject *nmobj;
if ((nmobj = sipClassName(sipSelf)) == NULL)
sipIsErr = 1;
else
{
char *cname = PyString_AsString(nmobj);
Py_BEGIN_ALLOW_THREADS
if (cname && tqApp)
sipRes = new TQString(tqApp -> translate(cname,a0,a1,TQApplication::DefaultCodec));
else
sipRes = new TQString(TQString::fromLatin1(a0));
Py_END_ALLOW_THREADS
Py_DECREF(nmobj);
}
%End
TQString trUtf8(const char *,const char * = 0);
%MethodCode
PyObject *nmobj;
if ((nmobj = sipClassName(sipSelf)) == NULL)
sipIsErr = 1;
else
{
char *cname = PyString_AsString(nmobj);
Py_BEGIN_ALLOW_THREADS
if (cname && tqApp)
sipRes = new TQString(tqApp -> translate(cname,a0,a1,TQApplication::UnicodeUTF8));
else
sipRes = new TQString(TQString::fromUtf8(a0));
Py_END_ALLOW_THREADS
Py_DECREF(nmobj);
}
%End
%End
virtual TQMetaObject *metaObject() const /AutoGen/;
virtual bool event(TQEvent *);
virtual bool eventFilter(TQObject *,TQEvent *);
bool isA(const char *) const;
%MethodCode
// The TQt implementation doesn't know anything about Python
// sub-classes. For SIP v4 we use the Python type's name. For
// SIP v3 we use the broken TQt behaviour as it's deprecated and
// we want to keep things simple.
#if SIP_VERSION >= 0x040000
sipRes = (strcmp(sipSelf -> ob_type -> tp_name,a0) == 0);
#else
Py_BEGIN_ALLOW_THREADS
sipRes = sipCpp -> TQObject::isA(a0);
Py_END_ALLOW_THREADS
#endif
%End
bool inherits(const char *) const;
%MethodCode
// The TQt implementation doesn't know anything about Python
// sub-classes. For SIP v4 we use the Python type's MRO. For
// SIP v3 we use the broken TQt behaviour as it's deprecated and
// we want to keep things simple.
#if SIP_VERSION >= 0x040000
PyObject *mro = sipSelf -> ob_type -> tp_mro;
sipRes = 0;
for (int i = 0; i < PyTuple_GET_SIZE(mro); ++i)
if (strcmp(((PyTypeObject *)PyTuple_GET_ITEM(mro,i)) -> tp_name,a0) == 0)
{
sipRes = 1;
break;
}
#else
Py_BEGIN_ALLOW_THREADS
sipRes = sipCpp -> TQObject::inherits(a0);
Py_END_ALLOW_THREADS
#endif
%End
%If (- TQt_3_0_0)
TQStringList superClasses(bool = 0) const;
%End
const char *name() const;
const char *name(const char *) const;
virtual void setName(const char *);
bool isWidgetType() const;
bool highPriority() const;
bool signalsBlocked() const;
void blockSignals(bool);
int startTimer(int);
void killTimer(int);
void killTimers();
%If (- TQt_3_0_0)
TQObject *child(const char *,const char * = 0);
%End
%If (TQt_3_0_0 -)
TQObject *child(const char *,const char * = 0,bool = 1);
%End
const TQObjectList *children() const;
%If (TQt_2_1_0 -)
static const TQObjectList *objectTrees();
%End
%If (- TQt_3_0_0)
TQObjectList *queryList(char * = 0,char * = 0,bool = 1,bool = 1);
%End
%If (TQt_3_0_0 -)
TQObjectList *queryList(char * = 0,char * = 0,bool = 1,bool = 1) const;
%MethodCode
// The TQt implementation doesn't know anything about Python
// sub-classes. For SIP v4 we get all classes and then use the
// Python type's MRO to weed out those we don't want. For SIP
// v3 we use the broken TQt behaviour as it's deprecated and we
// want to keep things simple.
#if SIP_VERSION >= 0x040000
sipRes = sipCpp -> TQObject::queryList(0, a1, a2, a3);
if (a0 && sipRes)
{
TQObject *o = sipRes -> first();
while (o)
{
bool remove = TRUE;
PyObject *pyo = sipConvertFromInstance(o, sipClass_TQObject, 0);
if (pyo)
{
PyObject *mro = pyo -> ob_type -> tp_mro;
for (int i = 0; i < PyTuple_GET_SIZE(mro); ++i)
if (strcmp(((PyTypeObject *)PyTuple_GET_ITEM(mro,i)) -> tp_name,a0) == 0)
{
remove = FALSE;
break;
}
Py_DECREF(pyo);
}
if (remove)
{
sipRes -> remove();
o = sipRes -> current();
}
else
o = sipRes -> next();
}
}
#else
Py_BEGIN_ALLOW_THREADS
sipRes = sipCpp -> TQObject::queryList(a0, a1, a2, a3);
Py_END_ALLOW_THREADS
#endif
%End
%End
virtual void insertChild(TQObject * /Transfer/);
virtual void removeChild(TQObject * /TransferBack/);
void installEventFilter(const TQObject *);
void removeEventFilter(const TQObject *);
static SIP_PYOBJECT connect(SIP_QOBJECT,SIP_SIGNAL,SIP_QOBJECT,SIP_SLOT);
%MethodCode
sipRes = sipConnectRx(a0,a1,a2,a3,0);
%End
static SIP_PYOBJECT connect(SIP_QOBJECT,SIP_SIGNAL,SIP_PYCALLABLE);
%MethodCode
sipRes = sipConnectRx(a0,a1,a2,0,0);
%End
SIP_PYOBJECT connect(SIP_QOBJECT,SIP_SIGNAL,SIP_SLOT) const;
%MethodCode
sipRes = sipConnectRx(a0,a1,sipSelf,a2,0);
%End
static SIP_PYOBJECT disconnect(SIP_QOBJECT,SIP_SIGNAL,SIP_QOBJECT,SIP_SLOT);
%MethodCode
sipRes = sipDisconnectRx(a0,a1,a2,a3);
%End
static SIP_PYOBJECT disconnect(SIP_QOBJECT,SIP_SIGNAL,SIP_PYCALLABLE);
%MethodCode
sipRes = sipDisconnectRx(a0,a1,a2,0);
%End
// bool disconnect(const char * = 0,const TQObject * = 0,const char * = 0);
// bool disconnect(const TQObject *,const char * = 0);
void dumpObjectTree();
void dumpObjectInfo();
TQObject *parent() const;
void emit(SIP_SIGNAL,SIP_PYTUPLE);
%MethodCode
if (pyqt3EmitSignal(sipSelf, a0, a1) < 0)
sipIsErr = 1;
%End
%If (TQt_PROPERTIES)
%If (TQt_2_1_0 - TQt_3_0_0)
bool setProperty(const char *,const TQVariant &);
TQVariant property(const char *) const;
%End
%If (TQt_3_0_0 -)
virtual bool setProperty(const char *,const TQVariant &);
virtual TQVariant property(const char *) const;
%End
%End
signals:
void destroyed();
%If (TQt_3_0_0 -)
void destroyed(TQObject *);
%End
public slots:
%If (TQt_3_0_0 -)
void deleteLater();
%End
public:
// This is actually protected, but we never need to call the real
// method.
SIP_PYOBJECT sender();
%MethodCode
sipRes = pyqt3GetSender();
%End
protected:
virtual void timerEvent(TQTimerEvent *);
virtual void childEvent(TQChildEvent *);
%If (TQt_3_0_0 -)
virtual void customEvent(TQCustomEvent *);
%End
private:
TQObject(const TQObject &);
};
SIP_PYOBJECT QT_TR_NOOP(SIP_PYOBJECT);
%MethodCode
Py_INCREF(a0);
sipRes = a0;
%End
SIP_PYOBJECT QT_TRANSLATE_NOOP(SIP_PYOBJECT,SIP_PYOBJECT);
%MethodCode
Py_INCREF(a1);
sipRes = a1;
%End
%End
%If (- TQt_2_00)
class TQObject
{
%TypeHeaderCode
#include <tqobject.h>
%End
public:
TQObject(TQObject * /TransferThis/ = 0,const char * = 0);
%ConvertToSubClassCode
// The table of Python class objects indexed by their names. The table
// must be sorted by name.
static sipStringTypeClassMap map[] = {
{sipName_TQAccel, &sipClass_TQAccel},
{sipName_TQApplication, &sipClass_TQApplication},
{sipName_TQBoxLayout, &sipClass_TQBoxLayout},
{sipName_TQButton, &sipClass_TQButton},
{sipName_TQButtonGroup, &sipClass_TQButtonGroup},
{sipName_TQCheckBox, &sipClass_TQCheckBox},
#if defined(SIP_FEATURE_TQt_CLIPBOARD)
{sipName_TQClipboard, &sipClass_TQClipboard},
#endif
{sipName_TQComboBox, &sipClass_TQComboBox},
{sipName_TQDialog, &sipClass_TQDialog},
{sipName_TQDoubleValidator, &sipClass_TQDoubleValidator},
{sipName_TQDragObject, &sipClass_TQDragObject},
#if defined(SIP_FEATURE_TQt_FILEDIALOG)
{sipName_TQFileDialog, &sipClass_TQFileDialog},
{sipName_TQFileIconProvider, &sipClass_TQFileIconProvider},
#endif
{sipName_TQFrame, &sipClass_TQFrame},
{sipName_TQGridLayout, &sipClass_TQGridLayout},
{sipName_TQGroupBox, &sipClass_TQGroupBox},
{sipName_TQHBoxLayout, &sipClass_TQHBoxLayout},
{sipName_TQHeader, &sipClass_TQHeader},
{sipName_TQImageDrag, &sipClass_TQImageDrag},
{sipName_TQIntValidator, &sipClass_TQIntValidator},
{sipName_TQLCDNumber, &sipClass_TQLCDNumber},
{sipName_TQLabel, &sipClass_TQLabel},
{sipName_TQLayout, &sipClass_TQLayout},
{sipName_TQLineEdit, &sipClass_TQLineEdit},
{sipName_TQListBox, &sipClass_TQListBox},
{sipName_TQListView, &sipClass_TQListView},
{sipName_TQMainWindow, &sipClass_TQMainWindow},
{sipName_TQMenuBar, &sipClass_TQMenuBar},
#if defined(SIP_FEATURE_TQt_MESSAGEBOX)
{sipName_TQMessageBox, &sipClass_TQMessageBox},
#endif
{sipName_TQMultiLineEdit, &sipClass_TQMultiLineEdit},
{sipName_TQPopupMenu, &sipClass_TQPopupMenu},
#if defined(WS_X11) && defined(SIP_FEATURE_TQt_PRINTDIALOG)
{sipName_TQPrintDialog, &sipClass_TQPrintDialog},
#endif
{sipName_TQProgressBar, &sipClass_TQProgressBar},
#if defined(SIP_FEATURE_TQt_PROGRESSDIALOG)
{sipName_TQProgressDialog, &sipClass_TQProgressDialog},
#endif
{sipName_TQPushButton, &sipClass_TQPushButton},
{sipName_TQRadioButton, &sipClass_TQRadioButton},
{sipName_TQScrollBar, &sipClass_TQScrollBar},
{sipName_TQScrollView, &sipClass_TQScrollView},
{sipName_TQSlider, &sipClass_TQSlider},
{sipName_TQSocketNotifier, &sipClass_TQSocketNotifier},
{sipName_TQSpinBox, &sipClass_TQSpinBox},
#if defined(SIP_FEATURE_TQt_SPLITTER)
{sipName_TQSplitter, &sipClass_TQSplitter},
#endif
{sipName_TQStatusBar, &sipClass_TQStatusBar},
{sipName_TQStoredDrag, &sipClass_TQStoredDrag},
{sipName_TQTabBar, &sipClass_TQTabBar},
{sipName_TQTextDrag, &sipClass_TQTextDrag},
{sipName_TQTimer, &sipClass_TQTimer},
{sipName_TQToolBar, &sipClass_TQToolBar},
{sipName_TQToolButton, &sipClass_TQToolButton},
{sipName_TQToolTipGroup, &sipClass_TQToolTipGroup},
{sipName_TQVBoxLayout, &sipClass_TQVBoxLayout},
{sipName_TQValidator, &sipClass_TQValidator},
{sipName_TQWidget, &sipClass_TQWidget},
{sipName_TQWidgetStack, &sipClass_TQWidgetStack}
};
sipClass = sipMapStringToClass(sipCpp -> className(),map,sizeof (map)/sizeof (map[0]));
%End
static SIP_PYOBJECT connect(SIP_QOBJECT,SIP_SIGNAL,SIP_QOBJECT,SIP_SLOT);
%MethodCode
sipRes = sipConnectRx(a0,a1,a2,a3,0);
%End
static SIP_PYOBJECT connect(SIP_QOBJECT,SIP_SIGNAL,SIP_PYCALLABLE);
%MethodCode
sipRes = sipConnectRx(a0,a1,a2,0,0);
%End
static SIP_PYOBJECT disconnect(SIP_QOBJECT,SIP_SIGNAL,SIP_QOBJECT,SIP_SLOT);
%MethodCode
sipRes = sipDisconnectRx(a0,a1,a2,a3);
%End
static SIP_PYOBJECT disconnect(SIP_QOBJECT,SIP_SIGNAL,SIP_PYCALLABLE);
%MethodCode
sipRes = sipDisconnectRx(a0,a1,a2,0);
%End
virtual bool event(TQEvent *);
virtual bool eventFilter(TQObject *,TQEvent *);
const char *tr(const char *) const;
virtual TQMetaObject *metaObject() const /AutoGen/;
// This is actually virtual. However, with the way we are implementing
// it we can ignore it.
SIP_PYOBJECT className() const;
%MethodCode
sipRes = sipClassName(sipSelf);
%End
bool isA(const char *) const;
bool inherits(const char *) const;
const char *name() const;
const char *name(const char *) const;
void setName(const char *);
bool isWidgetType() const;
bool highPriority() const;
bool signalsBlocked() const;
void blockSignals(bool);
int startTimer(int);
void killTimer(int);
void killTimers();
const TQObjectList *children() const;
TQObjectList *queryList(char * = 0,char * = 0,bool = 1,bool = 1);
void insertChild(TQObject * /Transfer/);
void removeChild(TQObject * /TransferBack/);
void installEventFilter(const TQObject *);
void removeEventFilter(const TQObject *);
// bool connect(TQObject *,const char *,const char *);
// bool disconnect(const char * = 0,const TQObject * = 0,const char * = 0);
// bool disconnect(const TQObject *,const char * = 0);
void dumpObjectTree();
void dumpObjectInfo();
TQObject *parent() const;
void emit(SIP_SIGNAL,SIP_PYTUPLE);
%MethodCode
if (sipEmitSignal(sipSelf,a0,a1) < 0)
sipIsErr = 1;
%End
signals:
void destroyed();
public:
// This is actually protected, but we never need to call the real
// method.
SIP_PYOBJECT sender();
%MethodCode
sipRes = pyqt3GetSender();
%End
protected:
virtual void timerEvent(TQTimerEvent *);
private:
TQObject(const TQObject &);
};
%End
SIP_PYOBJECT SLOT(const char *);
%MethodCode
if (!a0)
{
PyErr_Format(PyExc_TypeError,"qt.SLOT() slot name cannot be None");
sipIsErr = 1;
}
else
{
int len = strlen(a0);
if ((sipRes = PyString_FromStringAndSize(NULL,1 + len)) == NULL)
sipIsErr = 1;
else
{
char *dp = PyString_AS_STRING(sipRes);
*dp++ = '1';
memcpy(dp,a0,len + 1);
}
}
%End
SIP_PYOBJECT SIGNAL(const char *);
%MethodCode
if (!a0)
{
PyErr_Format(PyExc_TypeError,"qt.SIGNAL() signal cannot be None");
sipIsErr = 1;
}
else
{
int len = strlen(a0);
if ((sipRes = PyString_FromStringAndSize(NULL,1 + len)) == NULL)
sipIsErr = 1;
else
{
char *dp = PyString_AS_STRING(sipRes);
*dp++ = '2';
memcpy(dp,a0,len + 1);
}
}
%End
SIP_PYOBJECT PYSIGNAL(const char *);
%MethodCode
if (!a0)
{
PyErr_Format(PyExc_TypeError,"qt.PYSIGNAL() signal cannot be None");
sipIsErr = 1;
}
else
{
int len = strlen(a0);
if ((sipRes = PyString_FromStringAndSize(NULL,1 + len)) == NULL)
sipIsErr = 1;
else
{
char *dp = PyString_AS_STRING(sipRes);
*dp++ = '9';
memcpy(dp,a0,len + 1);
}
}
%End
%ModuleHeaderCode
int pyqt3EmitSignal(PyObject *self, const char *sig, PyObject *sigargs);
PyObject *pyqt3GetSender();
%End
// This is the TQt support code for SIP v4.4 and later.
%ModuleCode
#include <string.h>
#include <tqobject.h>
#include <tqvariant.h>
#include <tqmetaobject.h>
#include <private/qucom_p.h>
#include <private/qucomextra_p.h>
// These optional parts of the legacy TQt support API for SIP are implemented.
#undef sipTQtEmitSignal
#undef sipTQtConnectPySignal
#undef sipTQtDisconnectPySignal
// Declare explicit C linkage.
extern "C"
{
static void *sipTQtCreateUniversalSlot(sipWrapper *, const char *,
PyObject *, const char *, const char **, int);
static void sipTQtDestroyUniversalSlot(void *);
static void *sipTQtFindSlot(void *, const char *, PyObject *, const char *,
const char **);
static int sipTQtConnect(void *, const char *, void *, const char *, int);
static int sipTQtDisconnect(void *, const char *, void *, const char *);
static int sipTQtSameSignalSlotName(const char *, const char *);
static sipSlot *sipTQtFindSipslot(void *, void **);
static int sipTQtEmitSignal(PyObject *, const char *, PyObject *);
static int sipTQtConnectPySignal(PyObject *, const char *, PyObject *,
const char *);
static void sipTQtDisconnectPySignal(PyObject *, const char *,
PyObject *, const char *);
}
extern "C" {
// The meta-type for PyTQt classes. It is just a marker type so that we can
// safely cast to get access to PyTQt3-specific data structures.
PyTypeObject pyqtWrapperType_Type = {
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
"qt.pyqtWrapperType", /* tp_name */
sizeof (sipWrapperType), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
0, /* tp_init */
0, /* tp_alloc */
0, /* tp_new */
0, /* tp_free */
0, /* tp_is_gc */
0, /* tp_bases */
0, /* tp_mro */
0, /* tp_cache */
0, /* tp_subclasses */
0, /* tp_weaklist */
0, /* tp_del */
#if PY_VERSION_HEX >= 0x02060000
0, /* tp_version_tag */
#endif
};
/*
* An entry in a linked list of slots.
*/
typedef struct _pyqt3SlotList {
/* The receiver. */
sipSlot rx;
/* Next in the list. */
struct _pyqt3SlotList *next;
} pyqt3SlotList;
/*
* A Python signal.
*/
typedef struct _pyqt3PySig {
/* The name of the signal. */
char *name;
/* The list of receivers. */
pyqt3SlotList *rxlist;
/* Next in the list. */
struct _pyqt3PySig *next;
} pyqt3PySig;
/*
* The C++ wrapper object used by PyTQt3.
*/
typedef struct _pyqtWrapper {
/* The super-type. */
sipWrapper super;
/* The list of Python signals. */
pyqt3PySig *pySigList;
} pyqtWrapper;
/*
* Clear any slots connected to any Python signals.
*/
static void clear_py_signals_slots(pyqtWrapper *pw)
{
pyqt3PySig *ps;
for (ps = pw->pySigList; ps != NULL; ps = ps->next)
{
pyqt3SlotList *psrx;
for (psrx = ps->rxlist; psrx != NULL; psrx = psrx->next)
sipClearAnySlotReference(&psrx->rx);
}
}
/*
* Find the given Python signal.
*/
static pyqt3PySig *find_py_signal(pyqtWrapper *pw, const char *sig)
{
pyqt3PySig *ps;
for (ps = pw->pySigList; ps != NULL; ps = ps->next)
if (sipTQtSameSignalSlotName(ps->name, sig))
return ps;
return 0;
}
/*
* Free an slot list entry.
*/
static void free_slot_list(pyqt3SlotList *sl)
{
sipFreeSipslot(&sl->rx);
sipFree(sl);
}
/*
* The instance clear slot.
*/
static int pyqtWrapper_clear(pyqtWrapper *self)
{
clear_py_signals_slots(self);
return sipWrapper_Type->tp_clear((PyObject *)self);
}
/*
* The instance dealloc slot.
*/
static void pyqtWrapper_dealloc(pyqtWrapper *self)
{
clear_py_signals_slots(self);
while (self->pySigList != NULL)
{
pyqt3PySig *ps;
pyqt3SlotList *psrx;
/* Take this one out of the list. */
ps = self->pySigList;
self->pySigList = ps->next;
while ((psrx = ps->rxlist) != NULL)
{
ps->rxlist = psrx->next;
free_slot_list(psrx);
}
sipFree(ps->name);
sipFree(ps);
}
sipWrapper_Type->tp_dealloc((PyObject *)self);
}
/*
* The instance traverse slot.
*/
static int pyqtWrapper_traverse(pyqtWrapper *self, visitproc visit, void *arg)
{
int vret;
pyqt3PySig *ps;
if ((vret = sipWrapper_Type->tp_traverse((PyObject *)self, visit, arg)) != 0)
return vret;
for (ps = self->pySigList; ps != NULL; ps = ps->next)
{
pyqt3SlotList *psrx;
for (psrx = ps->rxlist; psrx != NULL; psrx = psrx->next)
if ((vret = sipVisitSlot(&psrx->rx, visit, arg)) != 0)
return vret;
}
return 0;
}
static sipWrapperType pyqtWrapper_Type = {
#if !defined(STACKLESS)
{
#endif
{
PyObject_HEAD_INIT(&pyqtWrapperType_Type)
0, /* ob_size */
"qt.pyqtWrapper", /* tp_name */
sizeof (pyqtWrapper), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)pyqtWrapper_dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */
0, /* tp_doc */
(traverseproc)pyqtWrapper_traverse, /* tp_traverse */
(inquiry)pyqtWrapper_clear, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
0, /* tp_init */
0, /* tp_alloc */
0, /* tp_new */
0, /* tp_free */
0, /* tp_is_gc */
0, /* tp_bases */
0, /* tp_mro */
0, /* tp_cache */
0, /* tp_subclasses */
0, /* tp_weaklist */
0, /* tp_del */
#if PY_VERSION_HEX >= 0x02060000
0, /* tp_version_tag */
#endif
},
#if !defined(STACKLESS)
},
#endif
0,
0,
0
};
};
// This enumerates the different dynamic signal argument types.
enum pyqt3SigArgType {
unknown_sat,
char_sat,
uchar_sat,
string_sat,
ustring_sat,
short_sat,
ushort_sat,
int_sat,
uint_sat,
long_sat,
ulong_sat,
longlong_sat,
ulonglong_sat,
float_sat,
double_sat,
enum_sat,
bool_sat,
void_sat,
class_sat,
classp_sat,
mtype_sat,
mtypep_sat,
qvariant_sat,
qvariantp_sat,
pyobject_sat,
schar_sat,
sstring_sat,
wchar_sat,
wstring_sat
};
// This defines a single dynamic signal argument type.
struct pyqt3SigArg
{
// The type.
pyqt3SigArgType atype;
union {
// The Python type for classes.
sipWrapperType *wt;
// The data for mapped types.
const sipTypeDef *mt;
// The Python type for named enums.
PyTypeObject *et;
} u;
};
// A parsed signal signature.
struct pyqt3Signature {
// The number of arguments.
int sg_nrargs;
// The parsed arguments (heap).
pyqt3SigArg *sg_args;
// The unparsed signature (heap).
char *sg_signature;
// The next in the list.
pyqt3Signature *sg_next;
};
// A connection to a universal slot.
struct pyqt3SlotConnection
{
// The transmitter TQObject.
void *sc_transmitter;
// The parsed signature.
const pyqt3Signature *sc_signature;
// The slot.
sipSlot sc_slot;
};
// This class is used as a slot on behalf of connections to a Python callable.
// It is derived from TQObject but is not run through moc. Instead the normal
// moc-generated methods are handwritten in order to implement a universal
// slot. This requires some knowledge of the internal implementation of
// signals and slots but it is likely that they will only change between major
// TQt versions.
class UniversalSlot : public TQObject
{
public:
UniversalSlot(TQObject *qtx, pyqt3SlotConnection *conn, const char **member);
~UniversalSlot();
virtual TQMetaObject *metaObject() const
{
return staticMetaObject();
}
virtual bool tqt_invoke(int, TQUObject *args);
static TQMetaObject *staticMetaObject();
static TQObject *lastSender;
static UniversalSlot *unislots;
UniversalSlot *nextus, *prevus;
pyqt3SlotConnection conn;
private:
static TQMetaObject *metaObj;
};
// Create a universal slot. Note that this will leak if there is no signal
// transmitter (ie. no parent) - TQTimer.singleShot() for example.
UniversalSlot::UniversalSlot(TQObject *qtx, pyqt3SlotConnection *connection, const char **member) : TQObject()
{
// Save the connection.
conn = *connection;
// Detect when the transmitter is destroyed.
if (qtx)
connect(qtx, SIGNAL(destroyed(TQObject *)), SLOT(deleteLater()));
// Return the slot to connect to.
*member = SLOT(unislot());
// Add this one to the global list.
nextus = unislots;
if (nextus)
nextus -> prevus = this;
prevus = 0;
unislots = this;
}
// Destroy a universal slot.
UniversalSlot::~UniversalSlot()
{
SIP_BLOCK_THREADS
sipFreeSipslot(&conn.sc_slot);
SIP_UNBLOCK_THREADS
// Remove this one from the global list.
if (nextus)
nextus -> prevus = prevus;
if (prevus)
prevus -> nextus = nextus;
else
unislots = nextus;
}
// The last Python signal sender.
static PyObject *py_sender = 0;
TQMetaObject *UniversalSlot::metaObj = 0;
#if TQT_VERSION >= 0x030100
static TQMetaObjectCleanUp cleanUp_UniversalSlot("UniversalSlot", &UniversalSlot::staticMetaObject);
#else
static TQMetaObjectCleanUp cleanUp_UniversalSlot;
#endif
TQObject *UniversalSlot::lastSender = 0;
UniversalSlot *UniversalSlot::unislots = 0;
TQMetaObject *UniversalSlot::staticMetaObject()
{
if (metaObj)
return metaObj;
// Define a single slot that takes no arguments and so will accept any
// connection.
static const TQUMethod slot = {"unislot", 0, 0};
static const TQMetaData slot_tbl[] = {
{"unislot()", &slot, TQMetaData::Public}
};
metaObj = TQMetaObject::new_metaobject(
"UniversalSlot", TQObject::staticMetaObject(),
slot_tbl, 1,
0, 0,
#ifndef TQT_NO_PROPERTIES
0, 0,
0, 0,
#endif
0, 0);
cleanUp_UniversalSlot.setMetaObject(metaObj);
return metaObj;
}
bool UniversalSlot::tqt_invoke(int id, TQUObject *qargs)
{
if (id - staticMetaObject()->slotOffset() != 0)
return TQObject::tqt_invoke(id, qargs);
bool ok = TRUE;
const pyqt3Signature *psig = conn.sc_signature;
TQVariant *qv;
// Save in case it is asked for later.
lastSender = const_cast<TQObject *>(sender());
// If the sender was a TQSignal then the single argument will be wrapped
// in a TQVariant instance. At the moment we handle int argument as
// that is all that is needed by PyTQt (and PyKDE).
if (lastSender->inherits("TQSignal"))
qv = &static_QUType_TQVariant.get(qargs + 1);
else
qv = 0;
#ifdef WITH_THREAD
PyGILState_STATE state = PyGILState_Ensure();
#endif
PyObject *argtup = PyTuple_New(psig->sg_nrargs);
if (!argtup)
ok = FALSE;
else
{
for (int a = 0; a < psig->sg_nrargs; ++a)
{
PyObject *arg;
++qargs;
switch (psig->sg_args[a].atype)
{
case char_sat:
case schar_sat:
case uchar_sat:
arg = PyString_FromStringAndSize((char *)static_QUType_ptr.get(qargs), 1);
break;
case string_sat:
case sstring_sat:
case ustring_sat:
arg = PyString_FromString((char *)static_QUType_ptr.get(qargs));
break;
case short_sat:
arg = PyInt_FromLong(*(short *)static_QUType_ptr.get(qargs));
break;
case ushort_sat:
arg = PyLong_FromUnsignedLong(*(unsigned short *)static_QUType_ptr.get(qargs));
break;
case int_sat:
if (qv)
arg = PyInt_FromLong(qv -> asInt());
else
arg = PyInt_FromLong(static_QUType_int.get(qargs));
break;
case uint_sat:
arg = PyLong_FromUnsignedLong(*(unsigned *)static_QUType_ptr.get(qargs));
break;
case long_sat:
arg = PyLong_FromLong(*(long *)static_QUType_ptr.get(qargs));
break;
case ulong_sat:
arg = PyLong_FromUnsignedLong(*(unsigned long *)static_QUType_ptr.get(qargs));
break;
case longlong_sat:
arg = PyLong_FromLongLong(*(PY_LONG_LONG *)static_QUType_ptr.get(qargs));
break;
case ulonglong_sat:
arg = PyLong_FromUnsignedLongLong(*(unsigned PY_LONG_LONG *)static_QUType_ptr.get(qargs));
break;
case float_sat:
arg = PyFloat_FromDouble(*(float *)static_QUType_ptr.get(qargs));
break;
case double_sat:
arg = PyFloat_FromDouble(static_QUType_double.get(qargs));
break;
case enum_sat:
arg = sipConvertFromNamedEnum(*(int *)static_QUType_ptr.get(qargs), psig->sg_args[a].u.et);
break;
case bool_sat:
arg = PyInt_FromLong(static_QUType_bool.get(qargs));
break;
case void_sat:
arg = sipConvertFromVoidPtr((void *)static_QUType_ptr.get(qargs));
break;
case class_sat:
case classp_sat:
arg = sipConvertFromInstance((void *)static_QUType_ptr.get(qargs),psig->sg_args[a].u.wt,0);
break;
case mtype_sat:
case mtypep_sat:
arg = sipConvertFromMappedType((void *)static_QUType_ptr.get(qargs),psig->sg_args[a].u.mt,0);
break;
case qvariant_sat:
case qvariantp_sat:
arg = sipConvertFromInstance((void *)&static_QUType_TQVariant.get(qargs),sipClass_TQVariant,0);
break;
case pyobject_sat:
arg = (PyObject *)static_QUType_ptr.get(qargs);
break;
default:
arg = Py_NotImplemented;
Py_INCREF(Py_NotImplemented);
}
PyTuple_SET_ITEM(argtup, a, arg);
}
// Dispatch to the real slot.
if (ok)
{
PyObject *res = sipInvokeSlot(&conn.sc_slot, argtup);
if (res)
Py_DECREF(res);
else
ok = FALSE;
}
Py_DECREF(argtup);
}
if (!ok)
PyErr_Print();
#ifdef WITH_THREAD
PyGILState_Release(state);
#endif
return ok;
}
static pyqt3Signature *parseSignature(const char *sig);
static void parseType(const char *type, pyqt3SigArg *arg);
// Factory function to create a universal slot instance. Returns a pointer to
// the instance or 0 if there was an error.
static void *sipTQtCreateUniversalSlot(sipWrapper *tx, const char *sig,
PyObject *rxObj, const char *slot, const char **member, int)
{
pyqt3SlotConnection conn;
/* Initialise the connection. */
conn.sc_transmitter = (tx ? sipGetCppPtr((sipSimpleWrapper *)tx, 0) : 0);
/* Save the real slot. */
if (sipSaveSlot(&conn.sc_slot, rxObj, slot) < 0)
return 0;
/* Parse the signature and create the universal slot. */
if ((conn.sc_signature = parseSignature(sig)) == NULL)
{
sipFreeSipslot(&conn.sc_slot);
return 0;
}
TQObject *qtx = 0;
// See if the transmitter is a TQObject in which case we will connect
// to it's destroyed signal so that the universal slot can be destroyed
// at the same time. (Note that we used to do this by making the
// universal slot a child of the transmitter. This doesn't work as
// expected because TQWidget destroys its children before emitting the
// destroyed signal.)
if (tx && PyObject_TypeCheck((PyObject *)tx, (PyTypeObject *)sipClass_TQObject))
qtx = reinterpret_cast<TQObject *>(conn.sc_transmitter);
return new UniversalSlot(qtx, &conn, member);
}
// Parse the signal arguments for a connection.
static pyqt3Signature *parseSignature(const char *sig)
{
static pyqt3Signature *psig_list = NULL;
pyqt3Signature *psig;
const char *sp, *ep;
// First see if it has already been parsed. Note that both sides of a
// connection will probably be parsed twice because the function names will
// be different even though the signatures will probably be the same. We
// could be more clever, the most saving is when repeatedly emitting a
// signal for which this is sufficient.
for (psig = psig_list; psig != NULL; psig = psig->sg_next)
if (sipTQtSameSignalSlotName(psig->sg_signature, sig))
return psig;
// Create a new one including space for the copy of the signature.
if ((psig = (pyqt3Signature *)sipMalloc(sizeof (pyqt3Signature) + strlen(sig) + 1)) == NULL)
return NULL;
psig->sg_signature = (char *)&psig[1];
psig->sg_nrargs = 0;
psig->sg_args = 0;
// Find the start and end of the arguments.
sp = strchr(sig, '(');
ep = strrchr(sig, ')');
// If the signal isn't well formed we assume TQt will pick it up.
if (sp && ep && sp < ep)
{
// Copy the signature arguments while counting them and removing
// non-significant spaces. Each argument is left as a '\0' terminated
// string.
char *dp = psig->sg_signature;
int depth = 0, nrcommas = 0, argstart = TRUE;
for (;;)
{
char ch = *++sp;
if (strchr(",*&)<>", ch))
{
// Backup over any previous trailing space.
if (dp > psig->sg_signature && dp[-1] == ' ')
--dp;
if (sp == ep)
{
*dp = '\0';
break;
}
if (ch == ',' && depth == 0)
{
*dp++ = '\0';
++nrcommas;
argstart = TRUE;
}
else
{
*dp++ = ch;
// Make sure commas in template arguments are ignored.
if (ch == '<')
++depth;
else if (ch == '>')
--depth;
}
}
else if (ch == ' ')
{
// Ignore leading and multiple spaces.
if (!argstart && dp[-1] != ' ')
*dp++ = ch;
}
else
{
*dp++ = ch;
argstart = FALSE;
}
}
// Handle the arguments now they are in a normal form.
if (*psig->sg_signature)
{
char *arg = psig->sg_signature;
int a;
// Allocate the space.
psig->sg_nrargs = nrcommas + 1;
if ((psig->sg_args = (pyqt3SigArg *)sipMalloc(sizeof (pyqt3SigArg) * psig->sg_nrargs)) == NULL)
{
sipFree(psig);
return NULL;
}
for (a = 0; a < psig->sg_nrargs; ++a)
{
parseType(arg, &psig->sg_args[a]);
// Move to the start of the next argument.
arg += strlen(arg) + 1;
}
}
}
// Make a deep copy of the signal.
strcpy(psig->sg_signature, sig);
// Add it to the list so it can be re-used.
psig->sg_next = psig_list;
psig_list = psig;
return psig;
}
// Parse a single type.
static void parseType(const char *type, pyqt3SigArg *arg)
{
size_t btlen = 0;
int unsup, isref = FALSE, indir = 0;
const char *ep;
pyqt3SigArgType sat = unknown_sat;
// Find the start of the significant part of the type.
if (strncmp(type, "const ", 6) == 0)
type += 6;
// Find the length of the base type, the number of indirections and if it
// is a reference.
for (ep = type; *ep; ++ep)
if (*ep == '&')
isref = TRUE;
else if (*ep == '*')
++indir;
else
++btlen;
// Extract the base type as a separate string.
char type_str[btlen + 1];
strncpy(type_str, type, btlen);
type_str[btlen] = '\0';
// Resolve any typedef which may mean more indirection.
type = sipResolveTypedef(type_str);
// See if we need to make another copy.
bool copy = false;
if (type)
{
btlen = strlen(type);
// Remove any additional indirection.
while (btlen)
{
if (type[--btlen] == '*')
{
copy = true;
++indir;
}
}
}
else
type = type_str;
// Make sure this doesn't go out of scope while it is being used.
char base_type_str[btlen + 1];
if (copy)
{
// Extract the base type again.
strncpy(base_type_str, type, btlen);
base_type_str[btlen] = '\0';
type = base_type_str;
}
// Assume that anything other than a base type is unsupported.
unsup = (isref || indir);
// Parse the base type.
switch (btlen)
{
case 3:
if (strcmp(type, "int") == 0)
sat = int_sat;
break;
case 4:
if (strcmp(type, "bool") == 0)
sat = bool_sat;
else if (strcmp(type, "long") == 0)
sat = long_sat;
else if (strcmp(type, "char") == 0)
{
sat = (indir ? string_sat : char_sat);
unsup = (isref || indir > 1);
}
else if (strcmp(type, "void") == 0)
{
sat = void_sat;
unsup = (isref || indir != 1);
}
break;
case 5:
if (strcmp(type, "float") == 0)
sat = float_sat;
else if (strcmp(type, "short") == 0)
sat = short_sat;
break;
case 6:
if (strcmp(type, "double") == 0)
sat = double_sat;
break;
case 7:
if (strcmp(type, "__int64") == 0)
sat = longlong_sat;
else if (strcmp(type, "wchar_t") == 0)
{
sat = (indir ? wstring_sat : wchar_sat);
unsup = (isref || indir > 1);
}
break;
case 8:
if (strcmp(type, "unsigned") == 0)
sat = uint_sat;
else if (strcmp(type, "TQVariant") == 0)
{
if (indir == 0)
{
sat = qvariant_sat;
unsup = FALSE;
}
else if (indir == 1)
{
sat = qvariantp_sat;
unsup = FALSE;
}
}
break;
case 9:
if (strcmp(type, "long long") == 0)
sat = longlong_sat;
break;
case 11:
if (strcmp(type, "signed char") == 0)
{
sat = (indir ? sstring_sat : schar_sat);
unsup = (isref || indir > 1);
}
break;
case 12:
if (strcmp(type, "unsigned int") == 0)
sat = uint_sat;
break;
case 13:
if (strcmp(type, "unsigned long") == 0)
sat = ulong_sat;
else if (strcmp(type, "unsigned char") == 0)
{
sat = (indir ? ustring_sat : uchar_sat);
unsup = (isref || indir > 1);
}
else if (strcmp(type, "PyTQt_PyObject") == 0 && indir == 0)
{
sat = pyobject_sat;
unsup = FALSE;
}
break;
case 14:
if (strcmp(type, "unsigned short") == 0)
sat = ushort_sat;
break;
case 16:
if (strcmp(type, "unsigned __int64") == 0)
sat = ulonglong_sat;
break;
case 18:
if (strcmp(type, "unsigned long long") == 0)
sat = ulonglong_sat;
break;
}
if (sat == unknown_sat)
{
const sipTypeDef *td = sipFindType(type);
if (td)
{
if (sipTypeIsClass(td))
{
if (indir == 0)
sat = class_sat;
else if (indir == 1)
sat = classp_sat;
arg->u.wt = (sipWrapperType *)sipTypeAsPyTypeObject(td);
}
else if (sipTypeIsMapped(td))
{
if (indir == 0)
sat = mtype_sat;
else if (indir == 1)
sat = mtypep_sat;
arg->u.mt = td;
}
else if (sipTypeIsEnum(td))
{
if (indir == 0)
sat = enum_sat;
arg->u.et = sipTypeAsPyTypeObject(td);
}
}
}
else if (unsup)
sat = unknown_sat;
arg->atype = sat;
}
// Dispose of a receiver that might be a universal slot.
static void sipTQtDestroyUniversalSlot(void *rx)
{
for (UniversalSlot *us = UniversalSlot::unislots; us; us = us->nextus)
if (us == reinterpret_cast<TQObject *>(rx))
{
delete us;
break;
}
}
// Search for the universal slot connected to a particular TQt signal.
static void *sipTQtFindSlot(void *tx, const char *sig, PyObject *rxObj,
const char *slot, const char **member)
{
for (UniversalSlot *us = UniversalSlot::unislots; us; us = us->nextus)
{
pyqt3SlotConnection *conn = &us->conn;
if (conn->sc_transmitter != tx)
continue;
if (!sipTQtSameSignalSlotName(conn->sc_signature->sg_signature, sig))
continue;
if (sipSameSlot(&conn->sc_slot, rxObj, slot))
{
*member = SLOT(unislot());
return us;
}
}
return 0;
}
// Connect a TQt signal to a TQt slot.
static int sipTQtConnect(void *tx, const char *sig, void *rx, const char *slot, int)
{
return TQObject::connect(reinterpret_cast<TQObject *>(tx), sig,
reinterpret_cast<TQObject *>(rx), slot);
}
// Disconnect a TQt signal from a TQt slot.
static int sipTQtDisconnect(void *tx, const char *sig, void *rx, const char *slot)
{
return TQObject::disconnect(reinterpret_cast<TQObject *>(tx), sig,
reinterpret_cast<TQObject *>(rx), slot);
}
// See if two signal or slot names are the same.
static int sipTQtSameSignalSlotName(const char *s1, const char *s2)
{
// moc formats signal names, so we should first convert the supplied
// string to the same format before comparing them. Instead we just
// compare them as they are, but ignoring all spaces - this will have
// the same result.
do
{
// Skip any spaces.
while (*s1 == ' ')
++s1;
while (*s2 == ' ')
++s2;
if (*s1++ != *s2)
return 0;
}
while (*s2++ != '\0');
return 1;
}
// Return the next slot for a particular transmitter. This will be called with
// the GIL locked.
static sipSlot *sipTQtFindSipslot(void *tx, void **context)
{
UniversalSlot *us = *reinterpret_cast<UniversalSlot **>(context);
if (!us)
us = UniversalSlot::unislots;
sipSlot *slot = 0;
while (us)
{
pyqt3SlotConnection *this_conn = &us->conn;
us = us->nextus;
if (this_conn->sc_transmitter == tx)
{
slot = &this_conn->sc_slot;
break;
}
}
*context = us;
return slot;
}
// Connect a slot from a Python signal.
static int sipTQtConnectPySignal(PyObject *txObj, const char *sig,
PyObject *rxObj, const char *slot)
{
pyqt3PySig *ps;
pyqt3SlotList *psrx;
pyqtWrapper *pw = (pyqtWrapper *)txObj;
/* Create a new one if necessary. */
if ((ps = find_py_signal(pw, sig)) == NULL)
{
if ((ps = (pyqt3PySig *)sipMalloc(sizeof (pyqt3PySig))) == NULL)
return -1;
if ((ps->name = (char *)sipMalloc(strlen(sig) + 1)) == NULL)
{
sipFree(ps);
return -1;
}
strcpy(ps->name, sig);
ps->rxlist = NULL;
ps->next = pw->pySigList;
pw->pySigList = ps;
}
/* Create the new receiver. */
if ((psrx = (pyqt3SlotList *)sipMalloc(sizeof (pyqt3SlotList))) == NULL)
return -1;
if (sipSaveSlot(&psrx->rx, rxObj, slot) < 0)
{
sipFree(psrx);
return -1;
}
psrx->next = ps->rxlist;
ps->rxlist = psrx;
return 0;
}
// Disconnect a slot from a Python signal.
static void sipTQtDisconnectPySignal(PyObject *txObj, const char *sig,
PyObject *rxObj, const char *slot)
{
pyqt3PySig *ps;
if ((ps = find_py_signal((pyqtWrapper *)txObj, sig)) != NULL)
{
pyqt3SlotList **psrxp;
for (psrxp = &ps->rxlist; *psrxp != NULL; psrxp = &(*psrxp)->next)
{
pyqt3SlotList *psrx = *psrxp;
if (sipSameSlot(&psrx->rx, rxObj, slot))
{
*psrxp = psrx->next;
free_slot_list(psrx);
break;
}
}
}
}
// Emit a signal for the sip module.
static int sipTQtEmitSignal(PyObject *self, const char *sig, PyObject *sigargs)
{
return pyqt3EmitSignal(self, sig, sigargs);
}
// Emit a Python or TQt signal.
int pyqt3EmitSignal(PyObject *self, const char *sig, PyObject *sigargs)
{
// Don't do anything if signals are blocked. TQt signals would be blocked
// anyway, but this blocks Python signals as well.
void *tx = sipGetCppPtr((sipSimpleWrapper *)self, sipType_TQObject);
if (!tx)
return 0;
if (reinterpret_cast<TQObject *>(tx)->signalsBlocked())
return 0;
// See if it is a TQt signal.
if (*sig == '2')
{
pyqt3QtSignal *tab;
// Search the table.
for (tab = ((pyqt3ClassTypeDef *)((sipWrapperType *)(self->ob_type))->type)->qt3_emit; tab->st_name != NULL; ++tab)
{
const char *sp, *tp;
bool found;
// Compare only the base name.
sp = &sig[1];
tp = tab->st_name;
found = true;
while (*sp != '\0' && *sp != '(' && *tp != '\0')
if (*sp++ != *tp++)
{
found = false;
break;
}
if (found)
return (*tab->st_emitfunc)((sipSimpleWrapper *)self, sigargs);
}
// It wasn't found if we got this far.
PyErr_Format(PyExc_NameError, "Invalid signal %s", &sig[1]);
return -1;
}
pyqt3PySig *ps = find_py_signal((pyqtWrapper *)self, sig);
if (ps)
{
int rc = 0;
pyqt3SlotList *rxlist = ps->rxlist;
// Forget the last TQt sender and remember this one.
UniversalSlot::lastSender = 0;
py_sender = self;
// Apply the arguments to each slot method.
while (rxlist && rc >= 0)
{
pyqt3SlotList *next;
PyObject *res;
// We get the next in the list before calling the slot in case the
// list gets changed by the slot - usually because the slot
// disconnects itself.
next = rxlist->next;
res = sipInvokeSlot(&rxlist->rx, sigargs);
if (res)
Py_DECREF(res);
else
rc = -1;
rxlist = next;
}
// Forget this as a sender.
py_sender = NULL;
return rc;
}
return 0;
}
// Return the most recent signal sender.
PyObject *pyqt3GetSender()
{
PyObject *sender;
// If there is a TQt sender then it is more recent than the last Python
// sender, so use it instead.
if (UniversalSlot::lastSender)
{
sender = sipConvertFromType(UniversalSlot::lastSender, sipType_TQObject,
NULL);
}
else
{
sender = (py_sender ? py_sender : Py_None);
Py_INCREF(sender);
}
return sender;
}
%End
%InitialisationCode
// Initialise the meta-type.
pyqtWrapperType_Type.tp_base = sipWrapperType_Type;
if (PyType_Ready(&pyqtWrapperType_Type) < 0)
Py_FatalError("qt: Failed to initialise pyqtWrapperType type");
// Register the meta-type.
if (sipRegisterPyType((PyTypeObject *)&pyqtWrapperType_Type) < 0)
Py_FatalError("qt: Failed to register pyqtWrapperType type");
// Initialise the super-type.
#if PY_VERSION_HEX >= 0x02050000
pyqtWrapper_Type.super.ht_type.tp_base = sipWrapper_Type;
#else
pyqtWrapper_Type.super.type.tp_base = sipWrapper_Type;
#endif
if (PyType_Ready((PyTypeObject *)&pyqtWrapper_Type) < 0)
Py_FatalError("qt: Failed to initialise pyqtWrapper type");
// Register the super-type.
if (sipRegisterPyType((PyTypeObject *)&pyqtWrapper_Type) < 0)
Py_FatalError("qt: Failed to register pyqtWrapper type");
%End
|