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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qobject.cpp:105 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQObject Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQObject Class Reference</h1>
<p>The TQObject class is the base class of all TQt objects.
<a href="#details">More...</a>
<p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when TQt is built with thread support.</p>
<p><tt>#include <<a href="qobject-h.html">qobject.h</a>></tt>
<p>Inherits <a href="qt.html">TQt</a>.
<p>Inherited by <a href="qaccel.html">TQAccel</a>, <a href="qaccessibleobject.html">TQAccessibleObject</a>, <a href="qaction.html">TQAction</a>, <a href="qapplication.html">TQApplication</a>, <a href="qassistantclient.html">TQAssistantClient</a>, <a href="qdatapump.html">TQDataPump</a>, <a href="qaxobject.html">TQAxObject</a>, <a href="qaxscript.html">TQAxScript</a>, <a href="qaxscriptmanager.html">TQAxScriptManager</a>, <a href="qwidget.html">TQWidget</a>, <a href="qcanvas.html">TQCanvas</a>, <a href="qstyle.html">TQStyle</a>, <a href="qclipboard.html">TQClipboard</a>, <a href="qcopchannel.html">TQCopChannel</a>, <a href="qdns.html">TQDns</a>, <a href="qlayout.html">TQLayout</a>, <a href="qdragobject.html">TQDragObject</a>, <a href="qeditorfactory.html">TQEditorFactory</a>, <a href="qeventloop.html">TQEventLoop</a>, <a href="qfileiconprovider.html">TQFileIconProvider</a>, <a href="qnetworkprotocol.html">TQNetworkProtocol</a>, <a href="qwskeyboardhandler.html">TQWSKeyboardHandler</a>, <a href="qnetworkoperation.html">TQNetworkOperation</a>, <a href="qnpinstance.html">TQNPInstance</a>, <a href="qobjectcleanuphandler.html">TQObjectCleanupHandler</a>, <a href="qprocess.html">TQProcess</a>, <a href="qserversocket.html">TQServerSocket</a>, <a href="qsessionmanager.html">TQSessionManager</a>, <a href="qsignal.html">TQSignal</a>, <a href="qsignalmapper.html">TQSignalMapper</a>, <a href="qsocket.html">TQSocket</a>, <a href="qsocketnotifier.html">TQSocketNotifier</a>, <a href="qsound.html">TQSound</a>, <a href="qsqldatabase.html">TQSqlDatabase</a>, <a href="qsqldriver.html">TQSqlDriver</a>, <a href="qsqlform.html">TQSqlForm</a>, <a href="qstylesheet.html">TQStyleSheet</a>, <a href="qtimer.html">TQTimer</a>, <a href="qtooltipgroup.html">TQToolTipGroup</a>, <a href="qtranslator.html">TQTranslator</a>, <a href="qurloperator.html">TQUrlOperator</a>, and <a href="qvalidator.html">TQValidator</a>.
<p><a href="qobject-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQObject"><b>TQObject</b></a> ( TQObject * parent = 0, const char * name = 0 )</li>
<li class=fn>virtual <a href="#~TQObject"><b>~TQObject</b></a> ()</li>
<li class=fn>virtual const char * <a href="#className"><b>className</b></a> () const</li>
<li class=fn>virtual TQMetaObject * <a href="#metaObject"><b>metaObject</b></a> () const</li>
<li class=fn>virtual bool <a href="#event"><b>event</b></a> ( TQEvent * e )</li>
<li class=fn>virtual bool <a href="#eventFilter"><b>eventFilter</b></a> ( TQObject * watched, TQEvent * e )</li>
<li class=fn>bool <a href="#isA"><b>isA</b></a> ( const char * clname ) const</li>
<li class=fn>bool <a href="#inherits"><b>inherits</b></a> ( const char * clname ) const</li>
<li class=fn>const char * <a href="#name"><b>name</b></a> () const</li>
<li class=fn>const char * <a href="#name-2"><b>name</b></a> ( const char * defaultName ) const</li>
<li class=fn>virtual void <a href="#setName"><b>setName</b></a> ( const char * name )</li>
<li class=fn>bool <a href="#isWidgetType"><b>isWidgetType</b></a> () const</li>
<li class=fn>bool <a href="#highPriority"><b>highPriority</b></a> () const</li>
<li class=fn>bool <a href="#signalsBlocked"><b>signalsBlocked</b></a> () const</li>
<li class=fn>void <a href="#blockSignals"><b>blockSignals</b></a> ( bool block )</li>
<li class=fn>int <a href="#startTimer"><b>startTimer</b></a> ( int interval )</li>
<li class=fn>void <a href="#killTimer"><b>killTimer</b></a> ( int id )</li>
<li class=fn>void <a href="#killTimers"><b>killTimers</b></a> ()</li>
<li class=fn>TQObject * <a href="#child"><b>child</b></a> ( const char * objName, const char * inheritsClass = 0, bool recursiveSearch = TRUE )</li>
<li class=fn>const TQObjectList * <a href="#children"><b>children</b></a> () const</li>
<li class=fn>TQObjectList * <a href="#queryList"><b>queryList</b></a> ( const char * inheritsClass = 0, const char * objName = 0, bool regexpMatch = TRUE, bool recursiveSearch = TRUE ) const</li>
<li class=fn>virtual void <a href="#insertChild"><b>insertChild</b></a> ( TQObject * obj )</li>
<li class=fn>virtual void <a href="#removeChild"><b>removeChild</b></a> ( TQObject * obj )</li>
<li class=fn>void <a href="#installEventFilter"><b>installEventFilter</b></a> ( const TQObject * filterObj )</li>
<li class=fn>void <a href="#removeEventFilter"><b>removeEventFilter</b></a> ( const TQObject * obj )</li>
<li class=fn>bool <a href="#connect-2"><b>connect</b></a> ( const TQObject * sender, const char * signal, const char * member ) const</li>
<li class=fn>bool <a href="#disconnect-2"><b>disconnect</b></a> ( const char * signal = 0, const TQObject * receiver = 0, const char * member = 0 )</li>
<li class=fn>bool <a href="#disconnect-3"><b>disconnect</b></a> ( const TQObject * receiver, const char * member = 0 )</li>
<li class=fn>void <a href="#dumpObjectTree"><b>dumpObjectTree</b></a> ()</li>
<li class=fn>void <a href="#dumpObjectInfo"><b>dumpObjectInfo</b></a> ()</li>
<li class=fn>virtual bool <a href="#setProperty"><b>setProperty</b></a> ( const char * name, const TQVariant & value )</li>
<li class=fn>virtual TQVariant <a href="#property"><b>property</b></a> ( const char * name ) const</li>
<li class=fn>TQObject * <a href="#parent"><b>parent</b></a> () const</li>
</ul>
<h2>Public Slots</h2>
<ul>
<li class=fn>void <a href="#deleteLater"><b>deleteLater</b></a> ()</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#destroyed"><b>destroyed</b></a> ()</li>
<li class=fn>void <a href="#destroyed-2"><b>destroyed</b></a> ( TQObject * obj )</li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li class=fn>TQString <a href="#tr"><b>tr</b></a> ( const char * sourceText, const char * comment )</li>
<li class=fn>TQString <a href="#trUtf8"><b>trUtf8</b></a> ( const char * sourceText, const char * comment )</li>
<li class=fn>const TQObjectList * <a href="#objectTrees"><b>objectTrees</b></a> ()</li>
<li class=fn>bool <a href="#connect"><b>connect</b></a> ( const TQObject * sender, const char * signal, const TQObject * receiver, const char * member )</li>
<li class=fn>bool <a href="#disconnect"><b>disconnect</b></a> ( const TQObject * sender, const char * signal, const TQObject * receiver, const char * member )</li>
</ul>
<h2>Properties</h2>
<ul>
<li class=fn>TQCString <a href="#name-prop"><b>name</b></a> - the name of this object</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>const TQObject * <a href="#sender"><b>sender</b></a> ()</li>
<li class=fn>virtual void <a href="#timerEvent"><b>timerEvent</b></a> ( TQTimerEvent * )</li>
<li class=fn>virtual void <a href="#childEvent"><b>childEvent</b></a> ( TQChildEvent * )</li>
<li class=fn>virtual void <a href="#customEvent"><b>customEvent</b></a> ( TQCustomEvent * )</li>
<li class=fn>virtual void <a href="#connectNotify"><b>connectNotify</b></a> ( const char * signal )</li>
<li class=fn>virtual void <a href="#disconnectNotify"><b>disconnectNotify</b></a> ( const char * signal )</li>
<li class=fn>virtual bool <a href="#checkConnectArgs"><b>checkConnectArgs</b></a> ( const char * signal, const TQObject * receiver, const char * member )</li>
</ul>
<h2>Static Protected Members</h2>
<ul>
<li class=fn>TQCString <a href="#normalizeSignalSlot"><b>normalizeSignalSlot</b></a> ( const char * signalSlot )</li>
</ul>
<h2>Related Functions</h2>
<ul>
<li class=fn>void * <a href="#qt_find_obj_child"><b>qt_find_obj_child</b></a> ( TQObject * parent, const char * type, const char * name )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQObject class is the base class of all TQt objects.
<p>
<p> TQObject is the heart of the <a href="object.html">TQt object model.</a> The central feature in this model is a very powerful
mechanism for seamless object communication called <a href="signalsandslots.html">signals and slots</a>. You can
connect a signal to a slot with <a href="#connect">connect</a>() and destroy the
connection with <a href="#disconnect">disconnect</a>(). To avoid never ending notification
loops you can temporarily block signals with <a href="#blockSignals">blockSignals</a>(). The
protected functions <a href="#connectNotify">connectNotify</a>() and <a href="#disconnectNotify">disconnectNotify</a>() make it
possible to track connections.
<p> TQObjects organize themselves in object trees. When you create a
TQObject with another object as parent, the object will
automatically do an <a href="#insertChild">insertChild</a>() on the parent and thus show up
in the parent's <a href="#children">children</a>() list. The parent takes ownership of the
object i.e. it will automatically delete its children in its
destructor. You can look for an object by name and optionally type
using <a href="#child">child</a>() or <a href="#queryList">queryList</a>(), and get the list of tree roots using
<a href="#objectTrees">objectTrees</a>().
<p> Every object has an object <a href="#name">name</a>() and can report its <a href="#className">className</a>()
and whether it <a href="#inherits">inherits</a>() another class in the TQObject inheritance
hierarchy.
<p> When an object is deleted, it emits a <a href="#destroyed">destroyed</a>() signal. You can
catch this signal to avoid dangling references to TQObjects. The
<a href="qguardedptr.html">TQGuardedPtr</a> class provides an elegant way to use this feature.
<p> TQObjects can receive events through <a href="#event">event</a>() and filter the events
of other objects. See <a href="#installEventFilter">installEventFilter</a>() and <a href="#eventFilter">eventFilter</a>() for
details. A convenience handler, <a href="#childEvent">childEvent</a>(), can be reimplemented
to catch child events.
<p> Last but not least, TQObject provides the basic timer support in
TQt; see <a href="qtimer.html">TQTimer</a> for high-level support for timers.
<p> Notice that the <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> macro is mandatory for any object that
implements signals, slots or properties. You also need to run the
<a href="moc.html">moc program (Meta Object Compiler)</a> on the
source file. We strongly recommend the use of this macro in <em>all</em>
subclasses of TQObject regardless of whether or not they actually
use signals, slots and properties, since failure to do so may lead
certain functions to exhibit undefined behaviour.
<p> All TQt widgets inherit TQObject. The convenience function
<a href="#isWidgetType">isWidgetType</a>() returns whether an object is actually a widget. It
is much faster than <a href="#inherits">inherits</a>( "TQWidget" ).
<p> Some TQObject functions, e.g. <a href="#children">children</a>(), <a href="#objectTrees">objectTrees</a>() and
<a href="#queryList">queryList</a>() return a <a href="qobjectlist.html">TQObjectList</a>. A TQObjectList is a <a href="qptrlist.html">TQPtrList</a> of
TQObjects. TQObjectLists support the same operations as TQPtrLists
and have an iterator class, TQObjectListIt.
<p>See also <a href="objectmodel.html">Object Model</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQObject"></a>TQObject::TQObject ( <a href="qobject.html">TQObject</a> * parent = 0, const char * name = 0 )
</h3>
Constructs an object called <em>name</em> with parent object, <em>parent</em>.
<p> The parent of an object may be viewed as the object's owner. For
instance, a <a href="qdialog.html">dialog box</a> is the parent of the
"OK" and "Cancel" buttons it contains.
<p> The destructor of a parent object destroys all child objects.
<p> Setting <em>parent</em> to 0 constructs an object with no parent. If the
object is a widget, it will become a top-level window.
<p> The object name is some text that can be used to identify a
TQObject. It's particularly useful in conjunction with <a href="designer-manual.html"><i>TQt Designer</i></a>. You can find an
object by name (and type) using <a href="#child">child</a>(). To find several objects
use <a href="#queryList">queryList</a>().
<p> <p>See also <a href="#parent">parent</a>(), <a href="#name-prop">name</a>, <a href="#child">child</a>(), and <a href="#queryList">queryList</a>().
<h3 class=fn><a name="~TQObject"></a>TQObject::~TQObject ()<tt> [virtual]</tt>
</h3>
Destroys the object, deleting all its child objects.
<p> All signals to and from the object are automatically disconnected.
<p> <b>Warning:</b> All child objects are deleted. If any of these objects
are on the stack or global, sooner or later your program will
crash. We do not recommend holding pointers to child objects from
outside the parent. If you still do, the <a href="#destroyed">TQObject::destroyed</a>()
signal gives you an opportunity to detect when an object is
destroyed.
<p> <b>Warning:</b> Deleting a TQObject while pending events are waiting to be
delivered can cause a crash. You must not delete the TQObject
directly from a thread that is not the GUI thread. Use the
<a href="#deleteLater">TQObject::deleteLater</a>() method instead, which will cause the event
loop to delete the object after all pending events have been
delivered to the object.
<h3 class=fn>void <a name="blockSignals"></a>TQObject::blockSignals ( bool block )
</h3>
Blocks signals if <em>block</em> is TRUE, or unblocks signals if <em>block</em> is FALSE.
<p> Emitted signals disappear into hyperspace if signals are blocked.
Note that the <a href="#destroyed">destroyed</a>() signals will be emitted even if the signals
for this object have been blocked.
<p>Examples: <a href="rot-example.html#x1371">rot13/rot13.cpp</a> and <a href="qaxserver-example-simple.html#x2525">simple/main.cpp</a>.
<h3 class=fn>bool <a name="checkConnectArgs"></a>TQObject::checkConnectArgs ( const char * signal, const <a href="qobject.html">TQObject</a> * receiver, const char * member )<tt> [virtual protected]</tt>
</h3>
<p> Returns TRUE if the <em>signal</em> and the <em>member</em> arguments are
compatible; otherwise returns FALSE. (The <em>receiver</em> argument is
currently ignored.)
<p> <b>Warning:</b> We recommend that you use the default implementation and
do not reimplement this function.
<p>
<h3 class=fn><a href="qobject.html">TQObject</a> * <a name="child"></a>TQObject::child ( const char * objName, const char * inheritsClass = 0, bool recursiveSearch = TRUE )
</h3>
Searches the children and optionally grandchildren of this object,
and returns a child that is called <em>objName</em> that inherits <em>inheritsClass</em>. If <em>inheritsClass</em> is 0 (the default), any class
matches.
<p> If <em>recursiveSearch</em> is TRUE (the default), <a href="#child">child</a>() performs a
depth-first search of the object's children.
<p> If there is no such object, this function returns 0. If there are
more than one, the first one found is retured; if you need all of
them, use <a href="#queryList">queryList</a>().
<h3 class=fn>void <a name="childEvent"></a>TQObject::childEvent ( <a href="qchildevent.html">TQChildEvent</a> * )<tt> [virtual protected]</tt>
</h3>
This event handler can be reimplemented in a subclass to receive
child events.
<p> Child events are sent to objects when children are inserted or
removed.
<p> Note that events with <a href="qevent.html#type">TQEvent::type</a>() <a href="qevent.html#Type-enum">TQEvent::ChildInserted</a> are
posted (with <a href="qapplication.html#postEvent">TQApplication::postEvent</a>()) to make sure that the
child's construction is completed before this function is called.
<p> If a child is removed immediately after it is inserted, the <tt>ChildInserted</tt> event may be suppressed, but the <tt>ChildRemoved</tt>
event will always be sent. In such cases it is possible that there
will be a <tt>ChildRemoved</tt> event without a corresponding <tt>ChildInserted</tt> event.
<p> If you change state based on <tt>ChildInserted</tt> events, call
<a href="qwidget.html#constPolish">TQWidget::constPolish</a>(), or do
<pre>
TQApplication::<a href="qapplication.html#sendPostedEvents">sendPostedEvents</a>( this, TQEvent::ChildInserted );
</pre>
in functions that depend on the state. One notable example is
<a href="qwidget.html#sizeHint">TQWidget::sizeHint</a>().
<p> <p>See also <a href="#event">event</a>() and <a href="qchildevent.html">TQChildEvent</a>.
<p>Reimplemented in <a href="qmainwindow.html#childEvent">TQMainWindow</a> and <a href="qsplitter.html#childEvent">TQSplitter</a>.
<h3 class=fn>const <a href="qobjectlist.html">TQObjectList</a> * <a name="children"></a>TQObject::children () const
</h3>
<p> Returns a list of child objects, or 0 if this object has no
children.
<p> The <a href="qobjectlist.html">TQObjectList</a> class is defined in the <a href="qobjectlist-h.html">qobjectlist.h</a> header
file.
<p> The first child added is the <a href="qptrlist.html#first">first</a>
object in the list and the last child added is the <a href="qptrlist.html#last">last</a> object in the list, i.e. new
children are appended at the end.
<p> Note that the list order changes when <a href="qwidget.html">TQWidget</a> children are <a href="qwidget.html#raise">raised</a> or <a href="qwidget.html#lower">lowered.</a> A widget that is raised becomes the last object
in the list, and a widget that is lowered becomes the first object
in the list.
<p> <p>See also <a href="#child">child</a>(), <a href="#queryList">queryList</a>(), <a href="#parent">parent</a>(), <a href="#insertChild">insertChild</a>(), and <a href="#removeChild">removeChild</a>().
<h3 class=fn>const char * <a name="className"></a>TQObject::className () const<tt> [virtual]</tt>
</h3>
<p> Returns the class name of this object.
<p> This function is generated by the <a href="metaobjects.html">Meta
Object Compiler.</a>
<p> <b>Warning:</b> This function will return the wrong name if the class
definition lacks the <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> macro.
<p> <p>See also <a href="#name-prop">name</a>, <a href="#inherits">inherits</a>(), <a href="#isA">isA</a>(), and <a href="#isWidgetType">isWidgetType</a>().
<p>Example: <a href="sql.html#x2235">sql/overview/custom1/main.cpp</a>.
<h3 class=fn>bool <a name="connect"></a>TQObject::connect ( const <a href="qobject.html">TQObject</a> * sender, const char * signal, const <a href="qobject.html">TQObject</a> * receiver, const char * member )<tt> [static]</tt>
</h3>
Connects <em>signal</em> from the <em>sender</em> object to <em>member</em> in object
<em>receiver</em>, and returns TRUE if the connection succeeds; otherwise
returns FALSE.
<p> You must use the SIGNAL() and SLOT() macros when specifying the <em>signal</em>
and the <em>member</em>, for example:
<pre>
<a href="qlabel.html">TQLabel</a> *label = new <a href="qlabel.html">TQLabel</a>;
<a href="qscrollbar.html">TQScrollBar</a> *scroll = new <a href="qscrollbar.html">TQScrollBar</a>;
TQObject::<a href="#connect">connect</a>( scroll, SIGNAL(<a href="qscrollbar.html#valueChanged">valueChanged</a>(int)),
label, SLOT(<a href="qlabel.html#setNum">setNum</a>(int)) );
</pre>
<p> This example ensures that the label always displays the current
scroll bar value. Note that the signal and slots parameters must not
contain any variable names, only the type. E.g. the following would
not work and return FALSE:
<a href="#connect">TQObject::connect</a>( scroll, SIGNAL(valueChanged(int v)),
label, SLOT(setNum(int v)) );
<p> A signal can also be connected to another signal:
<p> <pre>
class MyWidget : public <a href="qwidget.html">TQWidget</a>
{
<a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a>
public:
MyWidget();
signals:
void myUsefulSignal();
private:
<a href="qpushbutton.html">TQPushButton</a> *aButton;
};
MyWidget::MyWidget()
{
aButton = new <a href="qpushbutton.html">TQPushButton</a>( this );
<a href="#connect">connect</a>( aButton, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), SIGNAL(myUsefulSignal()) );
}
</pre>
<p> In this example, the MyWidget constructor relays a signal from a
private member variable, and makes it available under a name that
relates to MyWidget.
<p> A signal can be connected to many slots and signals. Many signals
can be connected to one slot.
<p> If a signal is connected to several slots, the slots are activated
in an arbitrary order when the signal is emitted.
<p> The function returns TRUE if it successfully connects the signal
to the slot. It will return FALSE if it cannot create the
connection, for example, if TQObject is unable to verify the
existence of either <em>signal</em> or <em>member</em>, or if their signatures
aren't compatible.
<p> A signal is emitted for <em>every</em> connection you make, so if you
duplicate a connection, two signals will be emitted. You can
always break a connection using <a href="#disconnect">disconnect</a>().
<p> <p>See also <a href="#disconnect">disconnect</a>().
<p>Examples: <a href="qaction-application-example.html#x1179">action/main.cpp</a>, <a href="simple-application-example.html#x1599">application/main.cpp</a>, <a href="extension-dialog-example.html#x2868">extension/main.cpp</a>, <a href="iconview-example.html#x1460">iconview/main.cpp</a>, <a href="archivesearch-example.html#x489">network/archivesearch/main.cpp</a>, <a href="regexptester-example.html#x2512">regexptester/main.cpp</a>, and <a href="tutorial1-02.html#x2291">t2/main.cpp</a>.
<h3 class=fn>bool <a name="connect-2"></a>TQObject::connect ( const <a href="qobject.html">TQObject</a> * sender, const char * signal, const char * member ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Connects <em>signal</em> from the <em>sender</em> object to this object's <em>member</em>.
<p> Equivalent to: <tt>TQObject::connect(sender, signal, this, member)</tt>.
<p> <p>See also <a href="#disconnect">disconnect</a>().
<h3 class=fn>void <a name="connectNotify"></a>TQObject::connectNotify ( const char * signal )<tt> [virtual protected]</tt>
</h3>
<p> This virtual function is called when something has been connected
to <em>signal</em> in this object.
<p> <b>Warning:</b> This function violates the object-oriented principle of
modularity. However, it might be useful when you need to perform
expensive initialization only if something is connected to a
signal.
<p> <p>See also <a href="#connect">connect</a>() and <a href="#disconnectNotify">disconnectNotify</a>().
<h3 class=fn>void <a name="customEvent"></a>TQObject::customEvent ( <a href="qcustomevent.html">TQCustomEvent</a> * )<tt> [virtual protected]</tt>
</h3>
This event handler can be reimplemented in a subclass to receive
custom events. Custom events are user-defined events with a type
value at least as large as the "User" item of the <a href="qevent.html#Type-enum">TQEvent::Type</a>
enum, and is typically a <a href="qcustomevent.html">TQCustomEvent</a> or TQCustomEvent subclass.
<p> <p>See also <a href="#event">event</a>() and <a href="qcustomevent.html">TQCustomEvent</a>.
<h3 class=fn>void <a name="deleteLater"></a>TQObject::deleteLater ()<tt> [slot]</tt>
</h3>
Performs a deferred deletion of this object.
<p> Instead of an immediate deletion this function schedules a
deferred delete event for processing when TQt returns to the main
event loop.
<p>Example: <a href="bigtable-example.html#x1290">table/bigtable/main.cpp</a>.
<h3 class=fn>void <a name="destroyed"></a>TQObject::destroyed ()<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the object is being destroyed.
<p> Note that the signal is emitted by the TQObject destructor, so
the object's virtual table is already degenerated at this point,
and it is not safe to call any functions on the object emitting
the signal. This signal can not be blocked.
<p> All the objects's children are destroyed immediately after this
signal is emitted.
<h3 class=fn>void <a name="destroyed-2"></a>TQObject::destroyed ( <a href="qobject.html">TQObject</a> * obj )<tt> [signal]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This signal is emitted immediately before the object <em>obj</em> is
destroyed, and can not be blocked.
<p> All the objects's children are destroyed immediately after this
signal is emitted.
<h3 class=fn>bool <a name="disconnect"></a>TQObject::disconnect ( const <a href="qobject.html">TQObject</a> * sender, const char * signal, const <a href="qobject.html">TQObject</a> * receiver, const char * member )<tt> [static]</tt>
</h3>
Disconnects <em>signal</em> in object <em>sender</em> from <em>member</em> in object
<em>receiver</em>.
<p> A signal-slot connection is removed when either of the objects
involved are destroyed.
<p> <a href="#disconnect">disconnect</a>() is typically used in three ways, as the following
examples demonstrate.
<ol type=1>
<li> Disconnect everything connected to an object's signals:
<pre>
<a href="#disconnect">disconnect</a>( myObject, 0, 0, 0 );
</pre>
equivalent to the non-static overloaded function
<pre>
myObject->disconnect();
</pre>
<li> Disconnect everything connected to a specific signal:
<pre>
<a href="#disconnect">disconnect</a>( myObject, SIGNAL(mySignal()), 0, 0 );
</pre>
equivalent to the non-static overloaded function
<pre>
myObject->disconnect( SIGNAL(mySignal()) );
</pre>
<li> Disconnect a specific receiver:
<pre>
<a href="#disconnect">disconnect</a>( myObject, 0, myReceiver, 0 );
</pre>
equivalent to the non-static overloaded function
<pre>
myObject->disconnect( myReceiver );
</pre>
</ol>
<p> 0 may be used as a wildcard, meaning "any signal", "any receiving
object", or "any slot in the receiving object", respectively.
<p> The <em>sender</em> may never be 0. (You cannot disconnect signals from
more than one object in a single call.)
<p> If <em>signal</em> is 0, it disconnects <em>receiver</em> and <em>member</em> from
any signal. If not, only the specified signal is disconnected.
<p> If <em>receiver</em> is 0, it disconnects anything connected to <em>signal</em>. If not, slots in objects other than <em>receiver</em> are not
disconnected.
<p> If <em>member</em> is 0, it disconnects anything that is connected to <em>receiver</em>. If not, only slots named <em>member</em> will be disconnected,
and all other slots are left alone. The <em>member</em> must be 0 if <em>receiver</em> is left out, so you cannot disconnect a
specifically-named slot on all objects.
<p> <p>See also <a href="#connect">connect</a>().
<h3 class=fn>bool <a name="disconnect-2"></a>TQObject::disconnect ( const char * signal = 0, const <a href="qobject.html">TQObject</a> * receiver = 0, const char * member = 0 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Disconnects <em>signal</em> from <em>member</em> of <em>receiver</em>.
<p> A signal-slot connection is removed when either of the objects
involved are destroyed.
<h3 class=fn>bool <a name="disconnect-3"></a>TQObject::disconnect ( const <a href="qobject.html">TQObject</a> * receiver, const char * member = 0 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Disconnects all signals in this object from <em>receiver</em>'s <em>member</em>.
<p> A signal-slot connection is removed when either of the objects
involved are destroyed.
<h3 class=fn>void <a name="disconnectNotify"></a>TQObject::disconnectNotify ( const char * signal )<tt> [virtual protected]</tt>
</h3>
<p> This virtual function is called when something has been
disconnected from <em>signal</em> in this object.
<p> <b>Warning:</b> This function violates the object-oriented principle of
modularity. However, it might be useful for optimizing access to
expensive resources.
<p> <p>See also <a href="#disconnect">disconnect</a>() and <a href="#connectNotify">connectNotify</a>().
<h3 class=fn>void <a name="dumpObjectInfo"></a>TQObject::dumpObjectInfo ()
</h3>
Dumps information about signal connections, etc. for this object
to the debug output.
<p> This function is useful for debugging, but does nothing if the
library has been compiled in release mode (i.e. without debugging
information).
<h3 class=fn>void <a name="dumpObjectTree"></a>TQObject::dumpObjectTree ()
</h3>
Dumps a tree of children to the debug output.
<p> This function is useful for debugging, but does nothing if the
library has been compiled in release mode (i.e. without debugging
information).
<h3 class=fn>bool <a name="event"></a>TQObject::event ( <a href="qevent.html">TQEvent</a> * e )<tt> [virtual]</tt>
</h3>
This virtual function receives events to an object and should
return TRUE if the event <em>e</em> was recognized and processed.
<p> The <a href="#event">event</a>() function can be reimplemented to customize the
behavior of an object.
<p> <p>See also <a href="#installEventFilter">installEventFilter</a>(), <a href="#timerEvent">timerEvent</a>(), <a href="qapplication.html#sendEvent">TQApplication::sendEvent</a>(), <a href="qapplication.html#postEvent">TQApplication::postEvent</a>(), and <a href="qwidget.html#event">TQWidget::event</a>().
<p>Reimplemented in <a href="qwidget.html#event">TQWidget</a>.
<h3 class=fn>bool <a name="eventFilter"></a>TQObject::eventFilter ( <a href="qobject.html">TQObject</a> * watched, <a href="qevent.html">TQEvent</a> * e )<tt> [virtual]</tt>
</h3>
Filters events if this object has been installed as an event
filter for the <em>watched</em> object.
<p> In your reimplementation of this function, if you want to filter
the event <em>e</em>, out, i.e. stop it being handled further, return
TRUE; otherwise return FALSE.
<p> Example:
<pre>
class MyMainWindow : public <a href="qmainwindow.html">TQMainWindow</a>
{
public:
MyMainWindow( <a href="qwidget.html">TQWidget</a> *parent = 0, const char *name = 0 );
protected:
bool eventFilter( TQObject *obj, TQEvent *ev );
private:
<a href="qtextedit.html">TQTextEdit</a> *textEdit;
};
MyMainWindow::MyMainWindow( <a href="qwidget.html">TQWidget</a> *parent, const char *name )
: <a href="qmainwindow.html">TQMainWindow</a>( parent, name )
{
textEdit = new <a href="qtextedit.html">TQTextEdit</a>( this );
<a href="qmainwindow.html#setCentralWidget">setCentralWidget</a>( textEdit );
textEdit-><a href="#installEventFilter">installEventFilter</a>( this );
}
bool MyMainWindow::<a href="#eventFilter">eventFilter</a>( TQObject *obj, TQEvent *ev )
{
if ( obj == textEdit ) {
if ( e->type() == TQEvent::KeyPress ) {
<a href="qkeyevent.html">TQKeyEvent</a> *k = (TQKeyEvent*)ev;
<a href="qapplication.html#qDebug">qDebug</a>( "Ate key press %d", k-><a href="qkeyevent.html#key">key</a>() );
return TRUE;
} else {
return FALSE;
}
} else {
// pass the event on to the parent class
return TQMainWindow::eventFilter( obj, ev );
}
}
</pre>
<p> Notice in the example above that unhandled events are passed to
the base class's <a href="#eventFilter">eventFilter</a>() function, since the base class
might have reimplemented eventFilter() for its own internal
purposes.
<p> <b>Warning:</b> If you delete the receiver object in this function, be
sure to return TRUE. Otherwise, TQt will forward the event to the
deleted object and the program might crash.
<p> <p>See also <a href="#installEventFilter">installEventFilter</a>().
<p>Reimplemented in <a href="qaccel.html#eventFilter">TQAccel</a>, <a href="qscrollview.html#eventFilter">TQScrollView</a>, and <a href="qspinbox.html#eventFilter">TQSpinBox</a>.
<h3 class=fn>bool <a name="highPriority"></a>TQObject::highPriority () const
</h3>
<p> Returns TRUE if the object is a high-priority object, or FALSE if
it is a standard-priority object.
<p> High-priority objects are placed first in TQObject's list of
children on the assumption that they will be referenced very
often.
<h3 class=fn>bool <a name="inherits"></a>TQObject::inherits ( const char * clname ) const
</h3>
Returns TRUE if this object is an instance of a class that
inherits <em>clname</em>, and <em>clname</em> inherits TQObject; otherwise
returns FALSE.
<p> A class is considered to inherit itself.
<p> Example:
<pre>
<a href="qtimer.html">TQTimer</a> *t = new <a href="qtimer.html">TQTimer</a>; // TQTimer inherits TQObject
t-><a href="#inherits">inherits</a>( "TQTimer" ); // returns TRUE
t-><a href="#inherits">inherits</a>( "TQObject" ); // returns TRUE
t-><a href="#inherits">inherits</a>( "TQButton" ); // returns FALSE
// TQScrollBar inherits TQWidget and TQRangeControl
<a href="qscrollbar.html">TQScrollBar</a> *s = new <a href="qscrollbar.html">TQScrollBar</a>( 0 );
s-><a href="#inherits">inherits</a>( "TQWidget" ); // returns TRUE
s-><a href="#inherits">inherits</a>( "TQRangeControl" ); // returns FALSE
</pre>
<p> (<a href="qrangecontrol.html">TQRangeControl</a> is not a TQObject.)
<p> <p>See also <a href="#isA">isA</a>() and <a href="#metaObject">metaObject</a>().
<p>Examples: <a href="statistics-example.html#x2783">table/statistics/statistics.cpp</a>, <a href="themes-example.html#x282">themes/metal.cpp</a>, and <a href="themes-example.html#x211">themes/wood.cpp</a>.
<h3 class=fn>void <a name="insertChild"></a>TQObject::insertChild ( <a href="qobject.html">TQObject</a> * obj )<tt> [virtual]</tt>
</h3>
Inserts an object <em>obj</em> into the list of child objects.
<p> <b>Warning:</b> This function cannot be used to make one widget the child
widget of another widget. Child widgets can only be created by
setting the parent widget in the constructor or by calling
<a href="qwidget.html#reparent">TQWidget::reparent</a>().
<p> <p>See also <a href="#removeChild">removeChild</a>() and <a href="qwidget.html#reparent">TQWidget::reparent</a>().
<h3 class=fn>void <a name="installEventFilter"></a>TQObject::installEventFilter ( const <a href="qobject.html">TQObject</a> * filterObj )
</h3>
<p> Installs an event filter <em>filterObj</em> on this object. For example:
<pre>
monitoredObj->installEventFilter( filterObj );
</pre>
<p> An event filter is an object that receives all events that are
sent to this object. The filter can either stop the event or
forward it to this object. The event filter <em>filterObj</em> receives
events via its <a href="#eventFilter">eventFilter</a>() function. The eventFilter() function
must return TRUE if the event should be filtered, (i.e. stopped);
otherwise it must return FALSE.
<p> If multiple event filters are installed on a single object, the
filter that was installed last is activated first.
<p> Here's a <tt>KeyPressEater</tt> class that eats the key presses of its
monitored objects:
<pre>
class KeyPressEater : public TQObject
{
...
protected:
bool eventFilter( TQObject *o, TQEvent *e );
};
bool KeyPressEater::<a href="#eventFilter">eventFilter</a>( TQObject *o, TQEvent *e )
{
if ( e->type() == TQEvent::KeyPress ) {
// special processing for key press
<a href="qkeyevent.html">TQKeyEvent</a> *k = (TQKeyEvent *)e;
<a href="qapplication.html#qDebug">qDebug</a>( "Ate key press %d", k-><a href="qkeyevent.html#key">key</a>() );
return TRUE; // eat event
} else {
// standard event processing
return FALSE;
}
}
</pre>
<p> And here's how to install it on two widgets:
<pre>
KeyPressEater *keyPressEater = new KeyPressEater( this );
<a href="qpushbutton.html">TQPushButton</a> *pushButton = new <a href="qpushbutton.html">TQPushButton</a>( this );
<a href="qlistview.html">TQListView</a> *listView = new <a href="qlistview.html">TQListView</a>( this );
pushButton-><a href="#installEventFilter">installEventFilter</a>( keyPressEater );
listView-><a href="#installEventFilter">installEventFilter</a>( keyPressEater );
</pre>
<p> The <a href="qaccel.html">TQAccel</a> class, for example, uses this technique to intercept
accelerator key presses.
<p> <b>Warning:</b> If you delete the receiver object in your <a href="#eventFilter">eventFilter</a>()
function, be sure to return TRUE. If you return FALSE, TQt sends
the event to the deleted object and the program will crash.
<p> <p>See also <a href="#removeEventFilter">removeEventFilter</a>(), <a href="#eventFilter">eventFilter</a>(), and <a href="#event">event</a>().
<h3 class=fn>bool <a name="isA"></a>TQObject::isA ( const char * clname ) const
</h3>
Returns TRUE if this object is an instance of the class <em>clname</em>;
otherwise returns FALSE.
<p> Example:
<pre>
<a href="qtimer.html">TQTimer</a> *t = new <a href="qtimer.html">TQTimer</a>; // TQTimer inherits TQObject
t-><a href="#isA">isA</a>( "TQTimer" ); // returns TRUE
t-><a href="#isA">isA</a>( "TQObject" ); // returns FALSE
</pre>
<p> <p>See also <a href="#inherits">inherits</a>() and <a href="#metaObject">metaObject</a>().
<h3 class=fn>bool <a name="isWidgetType"></a>TQObject::isWidgetType () const
</h3>
<p> Returns TRUE if the object is a widget; otherwise returns FALSE.
<p> Calling this function is equivalent to calling
<a href="#inherits">inherits</a>("TQWidget"), except that it is much faster.
<h3 class=fn>void <a name="killTimer"></a>TQObject::killTimer ( int id )
</h3>
Kills the timer with timer identifier, <em>id</em>.
<p> The timer identifier is returned by <a href="#startTimer">startTimer</a>() when a timer
event is started.
<p> <p>See also <a href="#timerEvent">timerEvent</a>(), <a href="#startTimer">startTimer</a>(), and <a href="#killTimers">killTimers</a>().
<h3 class=fn>void <a name="killTimers"></a>TQObject::killTimers ()
</h3>
Kills all timers that this object has started.
<p> <b>Warning:</b> Using this function can cause hard-to-find bugs: it kills
timers started by sub- and superclasses as well as those started
by you, which is often not what you want. We recommend using a
<a href="qtimer.html">TQTimer</a> or perhaps <a href="#killTimer">killTimer</a>().
<p> <p>See also <a href="#timerEvent">timerEvent</a>(), <a href="#startTimer">startTimer</a>(), and <a href="#killTimer">killTimer</a>().
<h3 class=fn><a href="qmetaobject.html">TQMetaObject</a> * <a name="metaObject"></a>TQObject::metaObject () const<tt> [virtual]</tt>
</h3>
<p> Returns a pointer to the <a href="metaobjects.html#meta-object">meta object</a> of this object.
<p> A meta object contains information about a class that inherits
TQObject, e.g. class name, superclass name, properties, signals and
slots. Every class that contains the <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> macro will also have
a meta object.
<p> The meta object information is retquired by the signal/slot
connection mechanism and the property system. The functions <a href="#isA">isA</a>()
and <a href="#inherits">inherits</a>() also make use of the meta object.
<h3 class=fn>const char * <a name="name"></a>TQObject::name () const
</h3><p>Returns the name of this object.
See the <a href="qobject.html#name-prop">"name"</a> property for details.
<h3 class=fn>const char * <a name="name-2"></a>TQObject::name ( const char * defaultName ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the name of this object, or <em>defaultName</em> if the object
does not have a name.
<h3 class=fn><a href="qcstring.html">TQCString</a> <a name="normalizeSignalSlot"></a>TQObject::normalizeSignalSlot ( const char * signalSlot )<tt> [static protected]</tt>
</h3>
Normlizes the signal or slot definition <em>signalSlot</em> by removing
unnecessary whitespace.
<h3 class=fn>const <a href="qobjectlist.html">TQObjectList</a> * <a name="objectTrees"></a>TQObject::objectTrees ()<tt> [static]</tt>
</h3>
Returns a pointer to the list of all object trees (their root
objects), or 0 if there are no objects.
<p> The <a href="qobjectlist.html">TQObjectList</a> class is defined in the <a href="qobjectlist-h.html">qobjectlist.h</a> header
file.
<p> The most recent root object created is the <a href="qptrlist.html#first">first</a> object in the list and the first root object added
is the <a href="qptrlist.html#last">last</a> object in the list.
<p> <p>See also <a href="#children">children</a>(), <a href="#parent">parent</a>(), <a href="#insertChild">insertChild</a>(), and <a href="#removeChild">removeChild</a>().
<h3 class=fn><a href="qobject.html">TQObject</a> * <a name="parent"></a>TQObject::parent () const
</h3>
<p> Returns a pointer to the parent object.
<p> <p>See also <a href="#children">children</a>().
<h3 class=fn><a href="qvariant.html">TQVariant</a> <a name="property"></a>TQObject::property ( const char * name ) const<tt> [virtual]</tt>
</h3>
Returns the value of the object's <em>name</em> property.
<p> If no such property exists, the returned variant is invalid.
<p> Information about all available properties are provided through
the <a href="#metaObject">metaObject</a>().
<p> <p>See also <a href="#setProperty">setProperty</a>(), <a href="qvariant.html#isValid">TQVariant::isValid</a>(), <a href="#metaObject">metaObject</a>(), <a href="qmetaobject.html#propertyNames">TQMetaObject::propertyNames</a>(), and <a href="qmetaobject.html#property">TQMetaObject::property</a>().
<p>Example: <a href="qaxcontainer-example-qutlook.html#x2729">qutlook/centralwidget.cpp</a>.
<h3 class=fn><a href="qobjectlist.html">TQObjectList</a> * <a name="queryList"></a>TQObject::queryList ( const char * inheritsClass = 0, const char * objName = 0, bool regexpMatch = TRUE, bool recursiveSearch = TRUE ) const
</h3>
Searches the children and optionally grandchildren of this object,
and returns a list of those objects that are named or that match
<em>objName</em> and inherit <em>inheritsClass</em>. If <em>inheritsClass</em> is 0
(the default), all classes match. If <em>objName</em> is 0 (the
default), all object names match.
<p> If <em>regexpMatch</em> is TRUE (the default), <em>objName</em> is a <a href="qregexp.html#regular-expression">regular expression</a> that the objects's names must match. The syntax is that
of a <a href="qregexp.html">TQRegExp</a>. If <em>regexpMatch</em> is FALSE, <em>objName</em> is a string
and object names must match it exactly.
<p> Note that <em>inheritsClass</em> uses single inheritance from TQObject,
the way <a href="#inherits">inherits</a>() does. According to inherits(), <a href="qmenubar.html">TQMenuBar</a>
inherits <a href="qwidget.html">TQWidget</a> but not <a href="qmenudata.html">TQMenuData</a>. This does not tquite match
reality, but is the best that can be done on the wide variety of
compilers TQt supports.
<p> Finally, if <em>recursiveSearch</em> is TRUE (the default), <a href="#queryList">queryList</a>()
searches <em>n</em>th-generation as well as first-generation children.
<p> If all this seems a bit complex for your needs, the simpler
<a href="#child">child</a>() function may be what you want.
<p> This somewhat contrived example disables all the buttons in this
window:
<pre>
<a href="qobjectlist.html">TQObjectList</a> *l = topLevelWidget()->queryList( "TQButton" );
TQObjectListIt it( *l ); // iterate over the buttons
TQObject *obj;
while ( (obj = it.current()) != 0 ) {
// for each found object...
++it;
((TQButton*)obj)->setEnabled( FALSE );
}
delete l; // delete the list, not the objects
</pre>
<p> The <a href="qobjectlist.html">TQObjectList</a> class is defined in the <a href="qobjectlist-h.html">qobjectlist.h</a> header
file.
<p> <b>Warning:</b> Delete the list as soon you have finished using it. The
list contains pointers that may become invalid at almost any time
without notice (as soon as the user closes a window you may have
dangling pointers, for example).
<p> <p>See also <a href="#child">child</a>(), <a href="#children">children</a>(), <a href="#parent">parent</a>(), <a href="#inherits">inherits</a>(), <a href="#name-prop">name</a>, and <a href="qregexp.html">TQRegExp</a>.
<h3 class=fn>void <a name="removeChild"></a>TQObject::removeChild ( <a href="qobject.html">TQObject</a> * obj )<tt> [virtual]</tt>
</h3>
Removes the child object <em>obj</em> from the list of children.
<p> <b>Warning:</b> This function will not remove a child widget from the
screen. It will only remove it from the parent widget's list of
children.
<p> <p>See also <a href="#insertChild">insertChild</a>() and <a href="qwidget.html#reparent">TQWidget::reparent</a>().
<h3 class=fn>void <a name="removeEventFilter"></a>TQObject::removeEventFilter ( const <a href="qobject.html">TQObject</a> * obj )
</h3>
Removes an event filter object <em>obj</em> from this object. The
request is ignored if such an event filter has not been installed.
<p> All event filters for this object are automatically removed when
this object is destroyed.
<p> It is always safe to remove an event filter, even during event
filter activation (i.e. from the <a href="#eventFilter">eventFilter</a>() function).
<p> <p>See also <a href="#installEventFilter">installEventFilter</a>(), <a href="#eventFilter">eventFilter</a>(), and <a href="#event">event</a>().
<h3 class=fn>const <a href="qobject.html">TQObject</a> * <a name="sender"></a>TQObject::sender ()<tt> [protected]</tt>
</h3>
Returns a pointer to the object that sent the signal, if called in
a slot activated by a signal; otherwise it returns 0. The pointer
is valid only during the execution of the slot that calls this
function.
<p> The pointer returned by this function becomes invalid if the
sender is destroyed, or if the slot is disconnected from the
sender's signal.
<p> <b>Warning:</b> This function violates the object-oriented principle of
modularity. However, getting access to the sender might be useful
when many signals are connected to a single slot. The sender is
undefined if the slot is called as a normal C++ function.
<h3 class=fn>void <a name="setName"></a>TQObject::setName ( const char * name )<tt> [virtual]</tt>
</h3>
Sets the object's name to <em>name</em>.
<h3 class=fn>bool <a name="setProperty"></a>TQObject::setProperty ( const char * name, const <a href="qvariant.html">TQVariant</a> & value )<tt> [virtual]</tt>
</h3>
Sets the value of the object's <em>name</em> property to <em>value</em>.
<p> Returns TRUE if the operation was successful; otherwise returns
FALSE.
<p> Information about all available properties is provided through the
<a href="#metaObject">metaObject</a>().
<p> <p>See also <a href="#property">property</a>(), <a href="#metaObject">metaObject</a>(), <a href="qmetaobject.html#propertyNames">TQMetaObject::propertyNames</a>(), and <a href="qmetaobject.html#property">TQMetaObject::property</a>().
<p>Example: <a href="qaxcontainer-example-qutlook.html#x2730">qutlook/centralwidget.cpp</a>.
<h3 class=fn>bool <a name="signalsBlocked"></a>TQObject::signalsBlocked () const
</h3>
<p> Returns TRUE if signals are blocked; otherwise returns FALSE.
<p> Signals are not blocked by default.
<p> <p>See also <a href="#blockSignals">blockSignals</a>().
<h3 class=fn>int <a name="startTimer"></a>TQObject::startTimer ( int interval )
</h3>
Starts a timer and returns a timer identifier, or returns zero if
it could not start a timer.
<p> A timer event will occur every <em>interval</em> milliseconds until
<a href="#killTimer">killTimer</a>() or <a href="#killTimers">killTimers</a>() is called. If <em>interval</em> is 0, then
the timer event occurs once every time there are no more window
system events to process.
<p> The virtual <a href="#timerEvent">timerEvent</a>() function is called with the <a href="qtimerevent.html">TQTimerEvent</a>
event parameter class when a timer event occurs. Reimplement this
function to get timer events.
<p> If multiple timers are running, the <a href="qtimerevent.html#timerId">TQTimerEvent::timerId</a>() can be
used to find out which timer was activated.
<p> Example:
<pre>
class MyObject : public TQObject
{
Q_OBJECT
public:
MyObject( TQObject *parent = 0, const char *name = 0 );
protected:
void timerEvent( <a href="qtimerevent.html">TQTimerEvent</a> * );
};
MyObject::MyObject( TQObject *parent, const char *name )
: TQObject( parent, name )
{
<a href="#startTimer">startTimer</a>( 50 ); // 50-millisecond timer
<a href="#startTimer">startTimer</a>( 1000 ); // 1-second timer
<a href="#startTimer">startTimer</a>( 60000 ); // 1-minute timer
}
void MyObject::<a href="#timerEvent">timerEvent</a>( <a href="qtimerevent.html">TQTimerEvent</a> *e )
{
<a href="qapplication.html#qDebug">qDebug</a>( "timer event, id %d", e-><a href="qtimerevent.html#timerId">timerId</a>() );
}
</pre>
<p> Note that <a href="qtimer.html">TQTimer</a>'s accuracy depends on the underlying operating
system and hardware. Most platforms support an accuracy of 20 ms;
some provide more. If TQt is unable to deliver the requested
number of timer clicks, it will silently discard some.
<p> The TQTimer class provides a high-level programming interface with
one-shot timers and timer signals instead of events.
<p> <p>See also <a href="#timerEvent">timerEvent</a>(), <a href="#killTimer">killTimer</a>(), <a href="#killTimers">killTimers</a>(), <a href="qeventloop.html#awake">TQEventLoop::awake</a>(), and <a href="qeventloop.html#aboutToBlock">TQEventLoop::aboutToBlock</a>().
<h3 class=fn>void <a name="timerEvent"></a>TQObject::timerEvent ( <a href="qtimerevent.html">TQTimerEvent</a> * )<tt> [virtual protected]</tt>
</h3>
This event handler can be reimplemented in a subclass to receive
timer events for the object.
<p> <a href="qtimer.html">TQTimer</a> provides a higher-level interface to the timer
functionality, and also more general information about timers.
<p> <p>See also <a href="#startTimer">startTimer</a>(), <a href="#killTimer">killTimer</a>(), <a href="#killTimers">killTimers</a>(), and <a href="#event">event</a>().
<p>Examples: <a href="biff-example.html#x1959">biff/biff.cpp</a>, <a href="dclock-example.html#x1102">dclock/dclock.cpp</a>, <a href="forever-example.html#x1048">forever/forever.cpp</a>, <a href="grapher-nsplugin-example.html#x2755">grapher/grapher.cpp</a>, <a href="qmag-example.html#x1781">qmag/qmag.cpp</a>, and <a href="xform-example.html#x1232">xform/xform.cpp</a>.
<h3 class=fn><a href="qstring.html">TQString</a> <a name="tr"></a>TQObject::tr ( const char * sourceText, const char * comment )<tt> [static]</tt>
</h3>
<p> Returns a translated version of <em>sourceText</em>, or <em>sourceText</em>
itself if there is no appropriate translated version. The
translation context is TQObject with <em>comment</em> (0 by default).
All TQObject subclasses using the <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> macro automatically have
a reimplementation of this function with the subclass name as
context.
<p> <b>Warning:</b> This method is reentrant only if all translators are
installed <em>before</em> calling this method. Installing or removing
translators while performing translations is not supported. Doing
so will probably result in crashes or other undesirable behavior.
<p> <p>See also <a href="#trUtf8">trUtf8</a>(), <a href="qapplication.html#translate">TQApplication::translate</a>(), and <a href="i18n.html">Internationalization with TQt</a>.
<p>Example: <a href="qdialog.html#x2130">network/networkprotocol/view.cpp</a>.
<h3 class=fn><a href="qstring.html">TQString</a> <a name="trUtf8"></a>TQObject::trUtf8 ( const char * sourceText, const char * comment )<tt> [static]</tt>
</h3>
<p> Returns a translated version of <em>sourceText</em>, or
<a href="qstring.html#fromUtf8">TQString::fromUtf8</a>(<em>sourceText</em>) if there is no appropriate
version. It is otherwise identical to <a href="#tr">tr</a>(<em>sourceText</em>, <em>comment</em>).
<p> <b>Warning:</b> This method is reentrant only if all translators are
installed <em>before</em> calling this method. Installing or removing
translators while performing translations is not supported. Doing
so will probably result in crashes or other undesirable behavior.
<p> <p>See also <a href="#tr">tr</a>() and <a href="qapplication.html#translate">TQApplication::translate</a>().
<hr><h2>Property Documentation</h2>
<h3 class=fn><a href="qcstring.html">TQCString</a> <a name="name-prop"></a>name</h3>
<p>This property holds the name of this object.
<p>You can find an object by name (and type) using <a href="#child">child</a>(). You can
find a set of objects with <a href="#queryList">queryList</a>().
<p> The object name is set by the constructor or by the <a href="#setName">setName</a>()
function. The object name is not very useful in the current
version of TQt, but will become increasingly important in the
future.
<p> If the object does not have a name, the <a href="#name">name</a>() function returns
"unnamed", so printf() (used in <a href="qapplication.html#qDebug">qDebug</a>()) will not be asked to
output a null pointer. If you want a null pointer to be returned
for unnamed objects, you can call name( 0 ).
<p> <pre>
<a href="qapplication.html#qDebug">qDebug</a>( "MyClass::setPrecision(): (%s) invalid precision %f",
<a href="#name">name</a>(), newPrecision );
</pre>
<p> <p>See also <a href="#className">className</a>(), <a href="#child">child</a>(), and <a href="#queryList">queryList</a>().
<p>Set this property's value with <a href="#setName">setName</a>() and get this property's value with <a href="#name">name</a>().
<hr><h2>Related Functions</h2>
<h3 class=fn>void * <a name="qt_find_obj_child"></a>qt_find_obj_child ( <a href="qobject.html">TQObject</a> * parent, const char * type, const char * name )
</h3>
<p> Returns a pointer to the object named <em>name</em> that inherits <em>type</em> and with a given <em>parent</em>.
<p> Returns 0 if there is no such child.
<p> <pre>
<a href="qlistbox.html">TQListBox</a> *c = (TQListBox *) <a href="#qt_find_obj_child">qt_find_obj_child</a>( myWidget, "TQListBox",
"my list box" );
if ( c )
c-><a href="qlistbox.html#insertItem">insertItem</a>( "another string" );
</pre>
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright © 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright © 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>
|