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
|
// This is the SIP interface definition for QObject.
//
// Copyright (c) 2007
// Riverbank Computing Limited <info@riverbankcomputing.co.uk>
//
// This file is part of PyQt.
//
// This copy of PyQt 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.
//
// PyQt 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
// PyQt; 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>QObject</Title>
<FuncSynopsis>
<FuncDef>bool <Function>disconnect</Function></FuncDef>
<ParamDef>const QObject *<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 QObject *<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 QObject *<Parameter>sender</Parameter></ParamDef>
<ParamDef>const char *<Parameter>signal</Parameter></ParamDef>
<ParamDef>const QObject *<Parameter>receiver</Parameter></ParamDef>
<ParamDef>const char *<Parameter>member</Parameter></ParamDef>
</FuncSynopsis>
<Para>
At the moment PyQt does not support the full behaviour of the corresponding Qt
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 (Qt_2_00 -)
class QObject : Qt
{
%TypeHeaderCode
#include <qobject.h>
#include <qapplication.h>
%End
public:
QObject(QObject * /TransferThis/ = 0,const char * = 0);
%ConvertToSubClassCode
static struct class_graph {
char *name;
sipWrapperType **type;
int yes, no;
} graph[] = {
{sipName_QWidget, &sipClass_QWidget, 25, 1},
#if QT_VERSION >= 0x030100 && defined(SIP_FEATURE_Qt_ASSISTANTCLIENT)
{sipName_QAssistantClient, &sipClass_QAssistantClient, -1, 2},
#else
{NULL, NULL, -1, 2},
#endif
{sipName_QSessionManager, &sipClass_QSessionManager, -1, 3},
{sipName_QTranslator, &sipClass_QTranslator, -1, 4},
#if QT_VERSION >= 0x030000
{sipName_QProcess, &sipClass_QProcess, -1, 5},
#else
{NULL, NULL, -1, 5},
#endif
{sipName_QToolTipGroup, &sipClass_QToolTipGroup, -1, 6},
#if defined(SIP_FEATURE_Qt_FILEDIALOG)
{sipName_QFileIconProvider, &sipClass_QFileIconProvider, -1, 7},
#else
{NULL, NULL, -1, 7},
#endif
#if QT_VERSION >= 220 && defined(SIP_FEATURE_Qt_ACTION)
{sipName_QAction, &sipClass_QAction, 89, 8},
#else
{NULL, NULL, -1, 8},
#endif
#if QT_VERSION >= 0x030000
{sipName_QObjectCleanupHandler, &sipClass_QObjectCleanupHandler, -1, 9},
#else
{NULL, NULL, -1, 9},
#endif
{sipName_QTimer, &sipClass_QTimer, -1, 10},
{sipName_QLayout, &sipClass_QLayout, 90, 11},
#if QT_VERSION >= 210 && defined(SIP_FEATURE_Qt_NETWORKPROTOCOL)
{sipName_QUrlOperator, &sipClass_QUrlOperator, -1, 12},
#else
{NULL, NULL, -1, 12},
#endif
{sipName_QStyleSheet, &sipClass_QStyleSheet, -1, 13},
{sipName_QValidator, &sipClass_QValidator, 94, 14},
#if QT_VERSION >= 210 && defined(SIP_FEATURE_Qt_NETWORKPROTOCOL)
{sipName_QNetworkOperation, &sipClass_QNetworkOperation, -1, 15},
#else
{NULL, NULL, -1, 15},
#endif
{sipName_QAccel, &sipClass_QAccel, -1, 16},
#if QT_VERSION >= 0x030100
{sipName_QEventLoop, &sipClass_QEventLoop, -1, 17},
#else
{NULL, NULL, -1, 17},
#endif
#if QT_VERSION >= 210 && defined(SIP_FEATURE_Qt_NETWORKPROTOCOL)
{sipName_QNetworkProtocol, &sipClass_QNetworkProtocol, -1, 18},
#else
{NULL, NULL, -1, 18},
#endif
#if QT_VERSION >= 220 && defined(SIP_FEATURE_Qt_SOUND)
{sipName_QSound, &sipClass_QSound, -1, 19},
#else
{NULL, NULL, -1, 19},
#endif
{sipName_QApplication, &sipClass_QApplication, -1, 20},
{sipName_QDragObject, &sipClass_QDragObject, 97, 21},
{sipName_QSocketNotifier, &sipClass_QSocketNotifier, -1, 22},
{sipName_QStyle, &sipClass_QStyle, 103, 23},
{sipName_QSignalMapper, &sipClass_QSignalMapper, -1, 24},
#if defined(SIP_FEATURE_Qt_CLIPBOARD)
{sipName_QClipboard, &sipClass_QClipboard, -1, -1},
#else
{NULL, NULL, -1, -1},
#endif
{sipName_QStatusBar, &sipClass_QStatusBar, -1, 26},
#if defined(SIP_FEATURE_Qt_SIZEGRIP)
{sipName_QSizeGrip, &sipClass_QSizeGrip, -1, 27},
#else
{NULL, NULL, -1, 27},
#endif
{sipName_QTabWidget, &sipClass_QTabWidget, -1, 28},
#if QT_VERSION >= 0x030000
{sipName_QDateEdit, &sipClass_QDateEdit, -1, 29},
#else
{NULL, NULL, -1, 29},
#endif
{sipName_QMainWindow, &sipClass_QMainWindow, -1, 30},
#if QT_VERSION >= 0x030000
{sipName_QDateTimeEdit, &sipClass_QDateTimeEdit, -1, 31},
#else
{NULL, NULL, -1, 31},
#endif
#if QT_VERSION >= 0x030000
{sipName_QTimeEdit, &sipClass_QTimeEdit, -1, 32},
#else
{NULL, NULL, -1, 32},
#endif
{sipName_QFrame, &sipClass_QFrame, 46, 33},
{sipName_QScrollBar, &sipClass_QScrollBar, -1, 34},
#if QT_VERSION >= 220 && defined(SIP_FEATURE_Qt_DIAL)
{sipName_QDial, &sipClass_QDial, -1, 35},
#else
{NULL, NULL, -1, 35},
#endif
{sipName_QButton, &sipClass_QButton, 75, 36},
{sipName_QTabBar, &sipClass_QTabBar, -1, 37},
{sipName_QDialog, &sipClass_QDialog, 79, 38},
{sipName_QComboBox, &sipClass_QComboBox, -1, 39},
{sipName_QHeader, &sipClass_QHeader, -1, 40},
#if QT_VERSION >= 0x030000
{sipName_QDockArea, &sipClass_QDockArea, -1, 41},
#else
{NULL, NULL, -1, 41},
#endif
#if QT_VERSION >= 0x030200
{sipName_QSplashScreen, &sipClass_QSplashScreen, -1, 42},
#else
{NULL, NULL, -1, 42},
#endif
{sipName_QSlider, &sipClass_QSlider, -1, 43},
{sipName_QSpinBox, &sipClass_QSpinBox, -1, 44},
#if QT_VERSION >= 210 && defined(SIP_FEATURE_Qt_WORKSPACE)
{sipName_QWorkspace, &sipClass_QWorkspace, -1, 45},
#else
{NULL, NULL, -1, 45},
#endif
#if QT_VERSION >= 0x030000
{sipName_QDesktopWidget, &sipClass_QDesktopWidget, -1, -1},
#else
{NULL, NULL, -1, -1},
#endif
{sipName_QGrid, &sipClass_QGrid, -1, 47},
{sipName_QLineEdit, &sipClass_QLineEdit, -1, 48},
#if QT_VERSION >= 0x030200
{sipName_QToolBox, &sipClass_QToolBox, -1, 49},
#else
{NULL, NULL, -1, 49},
#endif
{sipName_QWidgetStack, &sipClass_QWidgetStack, -1, 50},
#if QT_VERSION >= 0x030000
{sipName_QDockWindow, &sipClass_QDockWindow, 60, 51},
#else
{NULL, NULL, -1, 51},
#endif
{sipName_QMenuBar, &sipClass_QMenuBar, -1, 52},
{sipName_QLabel, &sipClass_QLabel, -1, 53},
{sipName_QGroupBox, &sipClass_QGroupBox, 61, 54},
{sipName_QPopupMenu, &sipClass_QPopupMenu, -1, 55},
#if defined(SIP_FEATURE_Qt_SPLITTER)
{sipName_QSplitter, &sipClass_QSplitter, -1, 56},
#else
{NULL, NULL, -1, 56},
#endif
{sipName_QProgressBar, &sipClass_QProgressBar, -1, 57},
{sipName_QScrollView, &sipClass_QScrollView, 66, 58},
{sipName_QHBox, &sipClass_QHBox, 74, 59},
{sipName_QLCDNumber, &sipClass_QLCDNumber, -1, -1},
{sipName_QToolBar, &sipClass_QToolBar, -1, -1},
{sipName_QButtonGroup, &sipClass_QButtonGroup, 64, 62},
{sipName_QHGroupBox, &sipClass_QHGroupBox, -1, 63},
{sipName_QVGroupBox, &sipClass_QVGroupBox, -1, -1},
{sipName_QVButtonGroup, &sipClass_QVButtonGroup, -1, 65},
{sipName_QHButtonGroup, &sipClass_QHButtonGroup, -1, -1},
#if QT_VERSION >= 210 && defined(SIP_FEATURE_Qt_ICONVIEW)
{sipName_QIconView, &sipClass_QIconView, -1, 67},
#else
{NULL, NULL, -1, 67},
#endif
{sipName_QListView, &sipClass_QListView, -1, 68},
{sipName_QListBox, &sipClass_QListBox, -1, 69},
#if QT_VERSION >= 0x030000
{sipName_QGridView, &sipClass_QGridView, -1, 70},
#else
{NULL, NULL, -1, 70},
#endif
#if QT_VERSION >= 0x030000
{sipName_QTextEdit, &sipClass_QTextEdit, 71, -1},
#else
{NULL, NULL, -1, -1},
#endif
{sipName_QTextBrowser, &sipClass_QTextBrowser, -1, 72},
{sipName_QMultiLineEdit, &sipClass_QMultiLineEdit, -1, 73},
{sipName_QTextView, &sipClass_QTextView, -1, -1},
{sipName_QVBox, &sipClass_QVBox, -1, -1},
{sipName_QToolButton, &sipClass_QToolButton, -1, 76},
{sipName_QRadioButton, &sipClass_QRadioButton, -1, 77},
{sipName_QPushButton, &sipClass_QPushButton, -1, 78},
{sipName_QCheckBox, &sipClass_QCheckBox, -1, -1},
#if defined(WS_X11) && defined(SIP_FEATURE_Qt_PRINTDIALOG)
{sipName_QPrintDialog, &sipClass_QPrintDialog, -1, 80},
#else
{NULL, NULL, -1, 80},
#endif
#if QT_VERSION >= 0x030000
{sipName_QErrorMessage, &sipClass_QErrorMessage, -1, 81},
#else
{NULL, NULL, -1, 81},
#endif
#if QT_VERSION >= 210 && defined(SIP_FEATURE_Qt_INPUTDIALOG)
{sipName_QInputDialog, &sipClass_QInputDialog, -1, 82},
#else
{NULL, NULL, -1, 82},
#endif
#if defined(SIP_FEATURE_Qt_MESSAGEBOX)
{sipName_QMessageBox, &sipClass_QMessageBox, -1, 83},
#else
{NULL, NULL, -1, 83},
#endif
#if defined(SIP_FEATURE_Qt_WIZARD)
{sipName_QWizard, &sipClass_QWizard, -1, 84},
#else
{NULL, NULL, -1, 84},
#endif
#if defined(SIP_FEATURE_Qt_COLORDIALOG)
{sipName_QColorDialog, &sipClass_QColorDialog, -1, 85},
#else
{NULL, NULL, -1, 85},
#endif
#if defined(SIP_FEATURE_Qt_FONTDIALOG)
{sipName_QFontDialog, &sipClass_QFontDialog, -1, 86},
#else
{NULL, NULL, -1, 86},
#endif
#if defined(SIP_FEATURE_Qt_FILEDIALOG)
{sipName_QFileDialog, &sipClass_QFileDialog, -1, 87},
#else
{NULL, NULL, -1, 87},
#endif
#if defined(SIP_FEATURE_Qt_PROGRESSDIALOG)
{sipName_QProgressDialog, &sipClass_QProgressDialog, -1, 88},
#else
{NULL, NULL, -1, 88},
#endif
#if defined(SIP_FEATURE_Qt_TABDIALOG)
{sipName_QTabDialog, &sipClass_QTabDialog, -1, -1},
#else
{NULL, NULL, -1, -1},
#endif
#if QT_VERSION >= 220 && defined(SIP_FEATURE_Qt_ACTION)
{sipName_QActionGroup, &sipClass_QActionGroup, -1, -1},
#else
{NULL, NULL, -1, -1},
#endif
{sipName_QGridLayout, &sipClass_QGridLayout, -1, 91},
{sipName_QBoxLayout, &sipClass_QBoxLayout, 92, -1},
{sipName_QHBoxLayout, &sipClass_QHBoxLayout, -1, 93},
{sipName_QVBoxLayout, &sipClass_QVBoxLayout, -1, -1},
{sipName_QDoubleValidator, &sipClass_QDoubleValidator, -1, 95},
{sipName_QIntValidator, &sipClass_QIntValidator, -1, 96},
#if QT_VERSION >= 0x030000
{sipName_QRegExpValidator, &sipClass_QRegExpValidator, -1, -1},
#else
{NULL, NULL, -1, -1},
#endif
{sipName_QTextDrag, &sipClass_QTextDrag, -1, 98},
{sipName_QStoredDrag, &sipClass_QStoredDrag, 101, 99},
#if QT_VERSION >= 210 && defined(SIP_FEATURE_Qt_ICONVIEW) && defined(SIP_FEATURE_Qt_DRAGANDDROP)
{sipName_QIconDrag, &sipClass_QIconDrag, -1, 100},
#else
{NULL, NULL, -1, 100},
#endif
{sipName_QImageDrag, &sipClass_QImageDrag, -1, -1},
#if QT_VERSION >= 210
{sipName_QColorDrag, &sipClass_QColorDrag, -1, 102},
#else
{NULL, NULL, -1, 102},
#endif
{sipName_QUriDrag, &sipClass_QUriDrag, -1, -1},
{sipName_QCommonStyle, &sipClass_QCommonStyle, 104, -1},
#if defined(SIP_FEATURE_Qt_STYLE_WINDOWS)
{sipName_QWindowsStyle, &sipClass_QWindowsStyle, 106, 105},
#else
{NULL, NULL, -1, 105},
#endif
#if defined(SIP_FEATURE_Qt_STYLE_MOTIF)
{sipName_QMotifStyle, &sipClass_QMotifStyle, 107, -1},
#else
{NULL, NULL, -1, -1},
#endif
#if defined(SIP_FEATURE_Qt_STYLE_PLATINUM)
{sipName_QPlatinumStyle, &sipClass_QPlatinumStyle, -1, 110},
#else
{NULL, NULL, -1, 110},
#endif
#if defined(SIP_FEATURE_Qt_STYLE_CDE)
{sipName_QCDEStyle, &sipClass_QCDEStyle, -1, 108},
#else
{NULL, NULL, -1, 108},
#endif
#if QT_VERSION >= 220 && defined(SIP_FEATURE_Qt_STYLE_MOTIFPLUS)
{sipName_QMotifPlusStyle, &sipClass_QMotifPlusStyle, -1, 109},
#else
{NULL, NULL, -1, 109},
#endif
#if QT_VERSION >= 220 && defined(SIP_FEATURE_Qt_STYLE_SGI)
{sipName_QSGIStyle, &sipClass_QSGIStyle, -1, -1},
#else
{NULL, NULL, -1, -1},
#endif
#if defined(PYQT_STYLE_WINDOWSXP)
{sipName_QWindowsXPStyle, &sipClass_QWindowsXPStyle, -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 (- Qt_3_0_0)
static QString tr(const char *) /AutoGen=Qt_TRANSLATION/;
%End
%If (Qt_2_2_0 - Qt_2_3_1)
// There was an apparent bug in moc prior to Qt v2.3.1 where this
// method wasn't automatically generated.
static QString tr(const char *,const char *);
%End
%If (Qt_2_3_1 - Qt_3_0_0)
static QString tr(const char *,const char *) /AutoGen=Qt_TRANSLATION/;
%End
%If (Qt_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.
QString 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 && qApp)
sipRes = new QString(qApp -> translate(cname,a0,a1,QApplication::DefaultCodec));
else
sipRes = new QString(QString::fromLatin1(a0));
Py_END_ALLOW_THREADS
Py_DECREF(nmobj);
}
%End
QString 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 && qApp)
sipRes = new QString(qApp -> translate(cname,a0,a1,QApplication::UnicodeUTF8));
else
sipRes = new QString(QString::fromUtf8(a0));
Py_END_ALLOW_THREADS
Py_DECREF(nmobj);
}
%End
%End
virtual QMetaObject *metaObject() const /AutoGen/;
virtual bool event(QEvent *);
virtual bool eventFilter(QObject *,QEvent *);
bool isA(const char *) const;
%MethodCode
// The Qt 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 Qt 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 -> QObject::isA(a0);
Py_END_ALLOW_THREADS
#endif
%End
bool inherits(const char *) const;
%MethodCode
// The Qt 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 Qt 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 -> QObject::inherits(a0);
Py_END_ALLOW_THREADS
#endif
%End
%If (- Qt_3_0_0)
QStringList 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 (- Qt_3_0_0)
QObject *child(const char *,const char * = 0);
%End
%If (Qt_3_0_0 -)
QObject *child(const char *,const char * = 0,bool = 1);
%End
const QObjectList *children() const;
%If (Qt_2_1_0 -)
static const QObjectList *objectTrees();
%End
%If (- Qt_3_0_0)
QObjectList *queryList(char * = 0,char * = 0,bool = 1,bool = 1);
%End
%If (Qt_3_0_0 -)
QObjectList *queryList(char * = 0,char * = 0,bool = 1,bool = 1) const;
%MethodCode
// The Qt 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 Qt behaviour as it's deprecated and we
// want to keep things simple.
#if SIP_VERSION >= 0x040000
sipRes = sipCpp -> QObject::queryList(0, a1, a2, a3);
if (a0 && sipRes)
{
QObject *o = sipRes -> first();
while (o)
{
bool remove = TRUE;
PyObject *pyo = sipConvertFromInstance(o, sipClass_QObject, 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 -> QObject::queryList(a0, a1, a2, a3);
Py_END_ALLOW_THREADS
#endif
%End
%End
virtual void insertChild(QObject * /Transfer/);
virtual void removeChild(QObject * /TransferBack/);
void installEventFilter(const QObject *);
void removeEventFilter(const QObject *);
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 QObject * = 0,const char * = 0);
// bool disconnect(const QObject *,const char * = 0);
void dumpObjectTree();
void dumpObjectInfo();
QObject *parent() const;
void emit(SIP_SIGNAL,SIP_PYTUPLE);
%MethodCode
if (sipEmitSignal(sipSelf,a0,a1) < 0)
sipIsErr = 1;
%End
%If (Qt_PROPERTIES)
%If (Qt_2_1_0 - Qt_3_0_0)
bool setProperty(const char *,const QVariant &);
QVariant property(const char *) const;
%End
%If (Qt_3_0_0 -)
virtual bool setProperty(const char *,const QVariant &);
virtual QVariant property(const char *) const;
%End
%End
signals:
void destroyed();
%If (Qt_3_0_0 -)
void destroyed(QObject *);
%End
public slots:
%If (Qt_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 = sipGetSender();
%End
protected:
virtual void timerEvent(QTimerEvent *);
virtual void childEvent(QChildEvent *);
%If (Qt_3_0_0 -)
virtual void customEvent(QCustomEvent *);
%End
private:
QObject(const QObject &);
};
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 (- Qt_2_00)
class QObject
{
%TypeHeaderCode
#include <qobject.h>
%End
public:
QObject(QObject * /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_QAccel, &sipClass_QAccel},
{sipName_QApplication, &sipClass_QApplication},
{sipName_QBoxLayout, &sipClass_QBoxLayout},
{sipName_QButton, &sipClass_QButton},
{sipName_QButtonGroup, &sipClass_QButtonGroup},
{sipName_QCheckBox, &sipClass_QCheckBox},
#if defined(SIP_FEATURE_Qt_CLIPBOARD)
{sipName_QClipboard, &sipClass_QClipboard},
#endif
{sipName_QComboBox, &sipClass_QComboBox},
{sipName_QDialog, &sipClass_QDialog},
{sipName_QDoubleValidator, &sipClass_QDoubleValidator},
{sipName_QDragObject, &sipClass_QDragObject},
#if defined(SIP_FEATURE_Qt_FILEDIALOG)
{sipName_QFileDialog, &sipClass_QFileDialog},
{sipName_QFileIconProvider, &sipClass_QFileIconProvider},
#endif
{sipName_QFrame, &sipClass_QFrame},
{sipName_QGridLayout, &sipClass_QGridLayout},
{sipName_QGroupBox, &sipClass_QGroupBox},
{sipName_QHBoxLayout, &sipClass_QHBoxLayout},
{sipName_QHeader, &sipClass_QHeader},
{sipName_QImageDrag, &sipClass_QImageDrag},
{sipName_QIntValidator, &sipClass_QIntValidator},
{sipName_QLCDNumber, &sipClass_QLCDNumber},
{sipName_QLabel, &sipClass_QLabel},
{sipName_QLayout, &sipClass_QLayout},
{sipName_QLineEdit, &sipClass_QLineEdit},
{sipName_QListBox, &sipClass_QListBox},
{sipName_QListView, &sipClass_QListView},
{sipName_QMainWindow, &sipClass_QMainWindow},
{sipName_QMenuBar, &sipClass_QMenuBar},
#if defined(SIP_FEATURE_Qt_MESSAGEBOX)
{sipName_QMessageBox, &sipClass_QMessageBox},
#endif
{sipName_QMultiLineEdit, &sipClass_QMultiLineEdit},
{sipName_QPopupMenu, &sipClass_QPopupMenu},
#if defined(WS_X11) && defined(SIP_FEATURE_Qt_PRINTDIALOG)
{sipName_QPrintDialog, &sipClass_QPrintDialog},
#endif
{sipName_QProgressBar, &sipClass_QProgressBar},
#if defined(SIP_FEATURE_Qt_PROGRESSDIALOG)
{sipName_QProgressDialog, &sipClass_QProgressDialog},
#endif
{sipName_QPushButton, &sipClass_QPushButton},
{sipName_QRadioButton, &sipClass_QRadioButton},
{sipName_QScrollBar, &sipClass_QScrollBar},
{sipName_QScrollView, &sipClass_QScrollView},
{sipName_QSlider, &sipClass_QSlider},
{sipName_QSocketNotifier, &sipClass_QSocketNotifier},
{sipName_QSpinBox, &sipClass_QSpinBox},
#if defined(SIP_FEATURE_Qt_SPLITTER)
{sipName_QSplitter, &sipClass_QSplitter},
#endif
{sipName_QStatusBar, &sipClass_QStatusBar},
{sipName_QStoredDrag, &sipClass_QStoredDrag},
{sipName_QTabBar, &sipClass_QTabBar},
{sipName_QTextDrag, &sipClass_QTextDrag},
{sipName_QTimer, &sipClass_QTimer},
{sipName_QToolBar, &sipClass_QToolBar},
{sipName_QToolButton, &sipClass_QToolButton},
{sipName_QToolTipGroup, &sipClass_QToolTipGroup},
{sipName_QVBoxLayout, &sipClass_QVBoxLayout},
{sipName_QValidator, &sipClass_QValidator},
{sipName_QWidget, &sipClass_QWidget},
{sipName_QWidgetStack, &sipClass_QWidgetStack}
};
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(QEvent *);
virtual bool eventFilter(QObject *,QEvent *);
const char *tr(const char *) const;
virtual QMetaObject *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 QObjectList *children() const;
QObjectList *queryList(char * = 0,char * = 0,bool = 1,bool = 1);
void insertChild(QObject * /Transfer/);
void removeChild(QObject * /TransferBack/);
void installEventFilter(const QObject *);
void removeEventFilter(const QObject *);
// bool connect(QObject *,const char *,const char *);
// bool disconnect(const char * = 0,const QObject * = 0,const char * = 0);
// bool disconnect(const QObject *,const char * = 0);
void dumpObjectTree();
void dumpObjectInfo();
QObject *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 = sipGetSender();
%End
protected:
virtual void timerEvent(QTimerEvent *);
private:
QObject(const QObject &);
};
%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
// This is Qt support code for SIP v4.4 and later.
%ModuleCode
#include <qobject.h>
#include <qvariant.h>
#include <qmetaobject.h>
#include <private/qucom_p.h>
#include <private/qucomextra_p.h>
// This class is used as a slot on behalf of connections to a Python callable.
// It is derived from QObject 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
// Qt versions.
class UniversalSlot : public QObject
{
public:
UniversalSlot(QObject *qtx, sipSlotConnection *conn, const char **member);
~UniversalSlot();
virtual QMetaObject *metaObject() const
{
return staticMetaObject();
}
virtual bool qt_invoke(int, QUObject *args);
static QMetaObject *staticMetaObject();
static const QObject *lastSender;
static UniversalSlot *unislots;
UniversalSlot *nextus, *prevus;
sipSlotConnection conn;
private:
static QMetaObject *metaObj;
};
// Create a universal slot. Note that this will leak if there is no signal
// transmitter (ie. no parent) - QTimer.singleShot() for example.
UniversalSlot::UniversalSlot(QObject *qtx, sipSlotConnection *connection, const char **member) : QObject()
{
// Save the connection.
conn = *connection;
// Detect when the transmitter is destroyed.
if (qtx)
connect(qtx, SIGNAL(destroyed(QObject *)), 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()
{
sipFreeConnection(&conn);
// Remove this one from the global list.
if (nextus)
nextus -> prevus = prevus;
if (prevus)
prevus -> nextus = nextus;
else
unislots = nextus;
}
QMetaObject *UniversalSlot::metaObj = 0;
#if QT_VERSION >= 0x030100
static QMetaObjectCleanUp cleanUp_UniversalSlot("UniversalSlot", &UniversalSlot::staticMetaObject);
#else
static QMetaObjectCleanUp cleanUp_UniversalSlot;
#endif
const QObject *UniversalSlot::lastSender = 0;
UniversalSlot *UniversalSlot::unislots = 0;
QMetaObject *UniversalSlot::staticMetaObject()
{
if (metaObj)
return metaObj;
// Define a single slot that takes no arguments and so will accept any
// connection.
static const QUMethod slot = {"unislot", 0, 0};
static const QMetaData slot_tbl[] = {
{"unislot()", &slot, QMetaData::Public}
};
metaObj = QMetaObject::new_metaobject(
"UniversalSlot", QObject::staticMetaObject(),
slot_tbl, 1,
0, 0,
#ifndef QT_NO_PROPERTIES
0, 0,
0, 0,
#endif
0, 0);
cleanUp_UniversalSlot.setMetaObject(metaObj);
return metaObj;
}
bool UniversalSlot::qt_invoke(int id, QUObject *qargs)
{
if (id - staticMetaObject()->slotOffset() != 0)
return QObject::qt_invoke(id, qargs);
bool ok = TRUE;
const sipSignature *psig = conn.sc_signature;
QVariant *qv;
// Save in case it is asked for later.
lastSender = sender();
// If the sender was a QSignal then the single argument will be wrapped
// in a QVariant instance. At the moment we handle int argument as
// that is all that is needed by PyQt (and PyKDE).
if (lastSender -> inherits("QSignal"))
qv = &static_QUType_QVariant.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_QVariant.get(qargs),sipClass_QVariant,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 && sipEmitToSlot(&conn.sc_slot, argtup) < 0)
ok = FALSE;
Py_DECREF(argtup);
}
if (!ok)
PyErr_Print();
#ifdef WITH_THREAD
PyGILState_Release(state);
#endif
return ok;
}
// Declare explicit C linkage.
extern "C"
{
static void *sipQtCreateUniversalSlot(sipWrapper *, sipSlotConnection *, const char **);
static void sipQtDestroyUniversalSlot(void *);
static void *sipQtFindSlot(void *, const char *, PyObject *, const char *, const char **);
static int sipQtConnect(void *, const char *, void *, const char *, int);
static int sipQtDisconnect(void *, const char *, void *, const char *);
static int sipQtSignalsBlocked(void *);
static const void *sipQtGetSender();
static void sipQtForgetSender();
static int sipQtSameSignalSlotName(const char *, const char *);
static sipSlotConnection *sipQtFindConnection(void *, void **);
}
// Factory function to create a universal slot instance. Returns a pointer to
// the instance or 0 if there was an error.
static void *sipQtCreateUniversalSlot(sipWrapper *tx, sipSlotConnection *conn, const char **member)
{
QObject *qtx = 0;
// See if the transmitter is a QObject 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 QWidget destroys its children before emitting the
// destroyed signal.)
if (tx && PyObject_TypeCheck(tx, (PyTypeObject *)sipClass_QObject))
qtx = reinterpret_cast<QObject *>(conn->sc_transmitter);
return new UniversalSlot(qtx, conn, member);
}
// Dispose of a receiver that might be a universal slot.
static void sipQtDestroyUniversalSlot(void *rx)
{
for (UniversalSlot *us = UniversalSlot::unislots; us; us = us->nextus)
if (us == reinterpret_cast<QObject *>(rx))
{
delete us;
break;
}
}
// Search for the universal slot connected to a particular Qt signal.
static void *sipQtFindSlot(void *tx, const char *sig, PyObject *rxObj, const char *slot, const char **member)
{
for (UniversalSlot *us = UniversalSlot::unislots; us; us = us->nextus)
if (sipSameConnection(&us->conn, tx, sig, rxObj, slot))
{
*member = SLOT(unislot());
return us;
}
return 0;
}
// Connect a Qt signal to a Qt slot.
static int sipQtConnect(void *tx, const char *sig, void *rx, const char *slot, int)
{
return QObject::connect(reinterpret_cast<QObject *>(tx), sig,
reinterpret_cast<QObject *>(rx), slot);
}
// Disconnect a Qt signal from a Qt slot.
static int sipQtDisconnect(void *tx, const char *sig, void *rx, const char *slot)
{
return QObject::disconnect(reinterpret_cast<QObject *>(tx), sig,
reinterpret_cast<QObject *>(rx), slot);
}
// See if signals are currently blocked for a QObject.
static int sipQtSignalsBlocked(void *qobj)
{
return reinterpret_cast<QObject *>(qobj)->signalsBlocked();
}
// Get the last sender for QObject::sender().
static const void *sipQtGetSender()
{
return UniversalSlot::lastSender;
}
// Forget the last sender.
static void sipQtForgetSender()
{
UniversalSlot::lastSender = 0;
}
// See if two signal or slot names are the same.
static int sipQtSameSignalSlotName(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 connection for a particular transmitter. This will be
// called with the GIL locked.
static sipSlotConnection *sipQtFindConnection(void *tx, void **context)
{
UniversalSlot *us = *reinterpret_cast<UniversalSlot **>(context);
if (!us)
us = UniversalSlot::unislots;
sipSlotConnection *conn = 0;
while (us)
{
sipSlotConnection *this_conn = &us->conn;
us = us->nextus;
if (this_conn->sc_transmitter == tx)
{
conn = this_conn;
break;
}
}
*context = us;
return conn;
}
%End
|