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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QObject Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QObject Class Reference</h1><br clear="all">
<p>
The QObject class is the base class of all Qt objects.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qobject-h.html">qobject.h</a>></code>
<p>
Inherits <a href="qt.html">Qt</a>.
<p>Inherited by <a href="qaccel.html">QAccel</a>, <a href="qaction.html">QAction</a>, <a href="qapplication.html">QApplication</a>, QAuServer, <a href="qcanvas.html">QCanvas</a>, <a href="qclipboard.html">QClipboard</a>, <a href="qcopchannel.html">QCopChannel</a>, <a href="qdatapump.html">QDataPump</a>, <a href="qdns.html">QDns</a>, QDnsSocket, QDragManager, <a href="qdragobject.html">QDragObject</a>, <a href="qfileiconprovider.html">QFileIconProvider</a>, QGuardedPtrPrivate, <a href="qlayout.html">QLayout</a>, <a href="qnpinstance.html">QNPInstance</a>, <a href="qnetworkoperation.html">QNetworkOperation</a>, <a href="qnetworkprotocol.html">QNetworkProtocol</a>, QSenderObject, <a href="qserversocket.html">QServerSocket</a>, <a href="qsessionmanager.html">QSessionManager</a>, <a href="qsignal.html">QSignal</a>, <a href="qsignalmapper.html">QSignalMapper</a>, <a href="qsocket.html">QSocket</a>, <a href="qsocketnotifier.html">QSocketNotifier</a>, <a href="qsound.html">QSound</a>, <a href="qstyle.html">QStyle</a>, <a href="qstylesheet.html">QStyleSheet</a>, <a href="qtimer.html">QTimer</a>, <a href="qtooltipgroup.html">QToolTipGroup</a>, <a href="qtranslator.html">QTranslator</a>, <a href="qurloperator.html">QUrlOperator</a>, <a href="qvalidator.html">QValidator</a>, QWSClient, <a href="qwskeyboardhandler.html">QWSKeyboardHandler</a>, <a href="qwsmousehandler.html">QWSMouseHandler</a>, <a href="qwsserver.html">QWSServer</a> and <a href="qwidget.html">QWidget</a>.
<p><a href="qobject-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#05dc66"><b>QObject</b></a>(QObject*parent=0, constchar*name=0)</div>
<li><div class="fn">virtual<a href="#be87bc"><b>~QObject</b></a>()</div>
<li><div class="fn">virtualbool<a href="#c8b023"><b>event</b></a>(QEvent*)</div>
<li><div class="fn">virtualbool<a href="#bb8547"><b>eventFilter</b></a>(QObject*, QEvent*)</div>
<li><div class="fn">virtualQMetaObject*<a href="#6a902d"><b>metaObject</b></a>()const</div>
<li><div class="fn">virtualconstchar*<a href="#421b72"><b>className</b></a>()const</div>
<li><div class="fn">bool<a href="#67dab2"><b>isA</b></a>(constchar*)const</div>
<li><div class="fn">bool<a href="#ac17a9"><b>inherits</b></a>(constchar*)const</div>
<li><div class="fn">constchar*<a href="#b47f73"><b>name</b></a>()const</div>
<li><div class="fn">constchar*<a href="#6f3030"><b>name</b></a>(constchar*defaultName)const</div>
<li><div class="fn">virtualvoid<a href="#f80913"><b>setName</b></a>(constchar*name)</div>
<li><div class="fn">bool<a href="#cf6203"><b>isWidgetType</b></a>()const</div>
<li><div class="fn">bool<a href="#78bb25"><b>highPriority</b></a>()const</div>
<li><div class="fn">bool<a href="#a974a8"><b>signalsBlocked</b></a>()const</div>
<li><div class="fn">void<a href="#b92444"><b>blockSignals</b></a>(boolb)</div>
<li><div class="fn">int<a href="#906d99"><b>startTimer</b></a>(intinterval)</div>
<li><div class="fn">void<a href="#f5e328"><b>killTimer</b></a>(intid)</div>
<li><div class="fn">void<a href="#66592d"><b>killTimers</b></a>()</div>
<li><div class="fn">QObject*<a href="#f255f5"><b>child</b></a>(constchar*name, constchar*type=0)</div>
<li><div class="fn">constQObjectList*<a href="#9026ce"><b>children</b></a>()const</div>
<li><div class="fn">QObjectList*<a href="#fd1a0e"><b>queryList</b></a>(constchar*inheritsClass=0, constchar*objName=0, boolregexpMatch=TRUE, boolrecursiveSearch=TRUE)</div>
<li><div class="fn">virtualvoid<a href="#6fcced"><b>insertChild</b></a>(QObject*)</div>
<li><div class="fn">virtualvoid<a href="#eb9b06"><b>removeChild</b></a>(QObject*)</div>
<li><div class="fn">void<a href="#b59963"><b>installEventFilter</b></a>(constQObject*)</div>
<li><div class="fn">void<a href="#f8855d"><b>removeEventFilter</b></a>(constQObject*)</div>
<li><div class="fn">bool<a href="#7a8c2f"><b>connect</b></a>(constQObject*sender, constchar*signal, constchar*member)const</div>
<li><div class="fn">bool<a href="#7fa847"><b>disconnect</b></a>(constchar*signal=0, constQObject*receiver=0, constchar*member=0)</div>
<li><div class="fn">bool<a href="#86a5c4"><b>disconnect</b></a>(constQObject*receiver, constchar*member=0)</div>
<li><div class="fn">void<a href="#af854e"><b>dumpObjectTree</b></a>()</div>
<li><div class="fn">void<a href="#57f1a6"><b>dumpObjectInfo</b></a>()</div>
<li><div class="fn">bool<a href="#f5fc85"><b>setProperty</b></a>(constchar*name, constQVariant&value)</div>
<li><div class="fn">QVariant<a href="#d1c761"><b>property</b></a>(constchar*name)const</div>
<li><div class="fn">QObject*<a href="#1b27d2"><b>parent</b></a>()const</div>
<li><div class="fn">QStringListsuperClasses(boolincludeThis=FALSE)const<em>(obsolete)</em></div>
</ul>
<h2>Signals</h2>
<ul>
<li><div class="fn">void<a href="#2f72ea"><b>destroyed</b></a>()</div>
</ul>
<h2>Static Public Members</h2>
<ul>
<li><div class="fn">QString<a href="#44b4c1"><b>tr</b></a>(constchar*)</div>
<li><div class="fn">QString<a href="#ba30fb"><b>tr</b></a>(constchar*, constchar*)</div>
<li><div class="fn">constQObjectList*<a href="#08fff2"><b>objectTrees</b></a>()</div>
<li><div class="fn">bool<a href="#c2d209"><b>connect</b></a>(constQObject*sender, constchar*signal, constQObject*receiver, constchar*member)</div>
<li><div class="fn">bool<a href="#b146b1"><b>disconnect</b></a>(constQObject*sender, constchar*signal, constQObject*receiver, constchar*member)</div>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class="fn">bool<b>activate_filters</b>(QEvent*)(internal)</div>
<li><div class="fn">QConnectionList*<a href="#d485d7"><b>receivers</b></a>(constchar*signal)const</div>
<li><div class="fn">void<b>activate_signal</b>(constchar*signal)(internal)</div>
<li><div class="fn">void<a href="#477abd"><b>activate_signal</b></a>(constchar*signal, short)</div>
<li><div class="fn">void<a href="#c2a40f"><b>activate_signal</b></a>(constchar*signal, int)</div>
<li><div class="fn">void<a href="#410caa"><b>activate_signal</b></a>(constchar*signal, long)</div>
<li><div class="fn">void<a href="#e6c5f9"><b>activate_signal</b></a>(constchar*signal, constchar*)</div>
<li><div class="fn">void<a href="#2ce05a"><b>activate_signal_bool</b></a>(constchar*signal, bool)</div>
<li><div class="fn">void<a href="#48ef7c"><b>activate_signal_string</b></a>(constchar*signal, QString)</div>
<li><div class="fn">void<a href="#69b5fb"><b>activate_signal_strref</b></a>(constchar*signal, constQString&)</div>
<li><div class="fn">constQObject*<a href="#2b5d74"><b>sender</b></a>()</div>
<li><div class="fn">virtualvoid<a href="#a6b8c8"><b>initMetaObject</b></a>()</div>
<li><div class="fn">virtualvoid<a href="#cc83af"><b>timerEvent</b></a>(QTimerEvent*)</div>
<li><div class="fn">virtualvoid<a href="#5c5734"><b>childEvent</b></a>(QChildEvent*)</div>
<li><div class="fn">virtualvoid<a href="#5ff2b9"><b>connectNotify</b></a>(constchar*signal)</div>
<li><div class="fn">virtualvoid<a href="#645b79"><b>disconnectNotify</b></a>(constchar*signal)</div>
<li><div class="fn">virtualbool<a href="#82f31c"><b>checkConnectArgs</b></a>(constchar*signal, constQObject*receiver, constchar*member)</div>
</ul>
<h2>Static Protected Members</h2>
<ul>
<li><div class="fn">QMetaObject*<a href="#3b1389"><b>staticMetaObject</b></a>()</div>
<li><div class="fn">QCString<a href="#0786f6"><b>normalizeSignalSlot</b></a>(constchar*signalSlot)</div>
<li><div class="fn">void<a href="#9e552d"><b>badSuperclassWarning</b></a>(constchar*className, constchar*superclassName)</div>
</ul>
<h2>Related Functions</h2>
(Note that these are not member functions.)
<ul>
<li>void * <a href="qobject.html#487bf1"><b>qt_find_obj_child</b></a> (QObject * parent, const char * type, const char * name)
</ul>
<h2>Properties</h2>
<table border=1 cellpadding=3 cellspacing=0>
<tr><th>Type<th>Name<th>READ<th>WRITE<th>Options
<tr><td>QCString<td>name<td>name<td>setName<td>
</table>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QObject class is the base class of all Qt objects.
<p>
QObject is the heart of the <a href="object.html">Qt object model.</a> The central feature in this model is a very powerful
mechanism for seamless object commuinication dubbed <a href="signalsandslots.html">signals and slots</a>. With <a href="#c2d209">connect</a>(), you
can connect a signal to a slot and destroy the connection again with
<a href="#b146b1">disconnect</a>(). To avoid never-ending notification loops, you can
temporarily block signals with <a href="#b92444">blockSignals</a>(). The protected
functions <a href="#5ff2b9">connectNotify</a>() and <a href="#645b79">disconnectNotify</a>() make it possible to
track connections.
<p>QObjects organize themselves in object trees. When you create a
QObject with another object as parent, it will automatically do an
<a href="#6fcced">insertChild</a>() on the parent and thus show up in the parent's
<a href="#9026ce">children</a>() list. The parent receives object ownership, 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="#f255f5">child</a>() or
<a href="#fd1a0e">queryList</a>(), and get the list of tree roots using <a href="#08fff2">objectTrees</a>().
<p>Every object has an object <a href="#6f3030">name</a>() and can report its <a href="#421b72">className</a>() and
whether it <a href="#ac17a9">inherits</a>() another class in the QObject inheritance
hierarchy.
<p>When an object is deleted, it emits a <a href="#2f72ea">destroyed</a>() signal. You can
catch this signal to avoid dangling references to QObjects. The
<a href="qguardedptr.html">QGuardedPtr</a> class provides an elegant way to use this feature.
<p>QObjects can receive events through <a href="#c8b023">event</a>() and filter events of
other objects. See <a href="#b59963">installEventFilter</a>() and <a href="#bb8547">eventFilter</a>() for
details. A convenience handler <a href="#5c5734">childEvent</a>() can be reimplemented to
catch child events.
<p>Last but not least, QObject provides the basic timer support in Qt,
see <a href="qtimer.html">QTimer</a> for high-level support for timers.
<p>Notice that the <code>Q_OBJECT</code> macro is mandatory for any object that
implement 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 to use the macro in <em>all</em>
subclasses of QObject regardless whether they actually use signals,
slots and properties or not. Otherwise certain functions can show
undefined behaviour.
<p>All Qt widgets inherit QObject. The convenience function
<a href="#cf6203">isWidgetType</a>() returns whether an object is actually a widget. It
is much faster than inherits( "<a href="qwidget.html">QWidget</a>" ).
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="05dc66"></a>QObject::QObject(QObject*parent=0, constchar*name=0)</h3>
<p>Constructs an object with the parent object <em>parent</em> and a <em>name.</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 inside it.
<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 a text that can be used to identify this QObject.
It's particularly useful in conjunction with
<a href=designer.html>the Qt Designer</a>.
You can find an object by name (and type) using <a href="#f255f5">child</a>(), and more
than one using <a href="#fd1a0e">queryList</a>().
<p>See also <a href="#1b27d2">parent</a>(), <a href="#6f3030">name</a>(), <a href="#f255f5">child</a>() and <a href="#fd1a0e">queryList</a>().
<h3 class="fn"><a name="be87bc"></a>QObject::~QObject() <code>[virtual]</code></h3>
<p>Destructs the object, deleting all its child objects.
<p>All signals to and from the object are automatically disconnected.<p><b>Warning:</b> <em>All</em> child objects are deleted. If any of these objects are
on the stack or global, your program will sooner or later crash. We do
not recommend holding pointers to child objects from outside the parent.
If you still do, the <a href="#2f72ea">QObject::destroyed</a>() signal gives you an
opportunity to detect when an object is destroyed.
<h3 class="fn">void<a name="e6c5f9"></a>QObject::activate_signal(constchar*signal, constchar*) <code>[protected]</code></h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="c2a40f"></a>QObject::activate_signal(constchar*signal, int) <code>[protected]</code></h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="410caa"></a>QObject::activate_signal(constchar*signal, long) <code>[protected]</code></h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="477abd"></a>QObject::activate_signal(constchar*signal, short) <code>[protected]</code></h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="2ce05a"></a>QObject::activate_signal_bool(constchar*signal, bool) <code>[protected]</code></h3>
<p>For internal use only.
<h3 class="fn">void<a name="48ef7c"></a>QObject::activate_signal_string(constchar*signal, <a href="qstring.html">QString</a>) <code>[protected]</code></h3>
<p>For internal use only.
<h3 class="fn">void<a name="69b5fb"></a>QObject::activate_signal_strref(constchar*signal, const<a href="qstring.html">QString</a>&) <code>[protected]</code></h3>
<p>For internal use only.
<h3 class="fn">void<a name="9e552d"></a>QObject::badSuperclassWarning(constchar*className, constchar*superclassName) <code>[staticprotected]</code></h3>
<p>Internal function, called from <a href="#a6b8c8">initMetaObject</a>(). Used to emit a warning
when a class containing the macro Q_OBJECT inherits from a class that
does not contain it.
<h3 class="fn">void<a name="b92444"></a>QObject::blockSignals(boolblock)</h3>
<p>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.
<h3 class="fn">bool<a name="82f31c"></a>QObject::checkConnectArgs(constchar*signal, constQObject*receiver, constchar*member) <code>[virtualprotected]</code></h3>
<p>Returns TRUE if the <em>signal</em> and the <em>member</em> arguments are compatible,
otherwise FALSE.<p><b>Warning:</b> We recommend that you do not reimplement this function but use the default
implementation.
<h3 class="fn">QObject*<a name="f255f5"></a>QObject::child(constchar*name, constchar*type=0)</h3>
<p>Searches through the children and grandchildren of this object for
an object named <em>name</em> and with type <em>type</em> (or a subclass of that
type), and returns a pointer to that object if it exists. If <em>type</em> is 0, any type matches.
<p>If there isn't any such object, this function returns null.
<p>If there is more than one, one of them is returned; use <a href="#fd1a0e">queryList</a>()
if you need all of them.
<h3 class="fn">void<a name="5c5734"></a>QObject::childEvent(<a href="qchildevent.html">QChildEvent</a>*) <code>[virtualprotected]</code></h3>
<p>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#cadf8c">QEvent::type</a>() <code>QEvent::ChildInserted</code> are
<em>posted</em> (with <a href="qapplication.html#552386">QApplication::postEvent</a>()), to make sure that the
child's construction is completed before this function is called.
<p>If you change state based on <code>ChildInserted</code> events, call
<a href="qwidget.html#b88671">QWidget::constPolish</a>(), or do
<code><a href="qapplication.html#72245c">QApplication::sendPostedEvents</a>( this, QEvent::ChildInserted );</code>
in functions that depend on the state. One notable example is
<a href="qwidget.html#290bcd">QWidget::sizeHint</a>().
<p>See also <a href="#c8b023">event</a>() and <a href="qchildevent.html">QChildEvent</a>.
<p>Reimplemented in <a href="qwidgetstack.html#1f1e38">QWidgetStack</a>, <a href="qgroupbox.html#474fdb">QGroupBox</a>, <a href="qmainwindow.html#366599">QMainWindow</a>, <a href="qworkspace.html#59a2b9">QWorkspace</a> and <a href="qsplitter.html#dc2f1d">QSplitter</a>.
<h3 class="fn">constQObjectList*<a name="9026ce"></a>QObject::children()const</h3>
<p>Returns a list of child objects, or 0 if this object has no children.
<p>The QObjectList class is defined in the qobjcoll.h header file.
<p>The latest child added is the <a href="qlist.html#df743c">first</a> object
in the list and the first child added is the <a href="qlist.html#74dca3">last</a> object in the list.
<p>Note that the list order changes when <a href="qwidget.html">QWidget</a> children are <a href="qwidget.html#15da8e">raised</a> or <a href="qwidget.html#30c0a6">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>See also <a href="#f255f5">child</a>(), <a href="#fd1a0e">queryList</a>(), <a href="#1b27d2">parent</a>(), <a href="#6fcced">insertChild</a>() and <a href="#eb9b06">removeChild</a>().
<h3 class="fn">constchar*<a name="421b72"></a>QObject::className()const <code>[virtual]</code></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 an invalid name if the class
definition lacks the <code>Q_OBJECT</code> macro.
<p>See also <a href="#6f3030">name</a>(), <a href="#ac17a9">inherits</a>(), <a href="#67dab2">isA</a>() and <a href="#cf6203">isWidgetType</a>().
<h3 class="fn">bool<a name="c2d209"></a>QObject::connect(constQObject*sender, constchar*signal, constQObject*receiver, constchar*member) <code>[static]</code></h3>
<p>Connects <em>signal</em> from the <em>sender</em> object to <em>member</em> in object <em>receiver.</em>
<p>You must use the SIGNAL() and SLOT() macros when specifying the <em>signal</em>
and the <em>member.</em>
<p>Example:
<pre> <a href="qlabel.html">QLabel</a> *label = new <a href="qlabel.html">QLabel</a>;
<a href="qscrollbar.html">QScrollBar</a> *scroll = new <a href="qscrollbar.html">QScrollBar</a>;
<a href="#c2d209">QObject::connect</a>( scroll, SIGNAL(valueChanged(int)),
label, SLOT(setNum(int)) );
</pre>
<p>This example connects the scroll bar's <a href="qscrollbar.html#c546c7">valueChanged()</a> signal to the label's <a href="qlabel.html#1a8f6a">setNum()</a> slot. It makes the label always display the current
scroll bar value.
<p>A signal can even be connected to another signal, i.e. <em>member</em> is
a SIGNAL().
<p><pre> class MyWidget : public QWidget
{
public:
MyWidget();
...
signals:
void aSignal();
...
private:
...
<a href="qpushbutton.html">QPushButton</a> *aButton;
};
MyWidget::MyWidget()
{
aButton = new <a href="qpushbutton.html">QPushButton</a>( this );
<a href="#c2d209">connect</a>( aButton, SIGNAL(clicked()), SIGNAL(aSignal()) );
}
</pre>
<p>In its constructor, MyWidget creates a private button and connects the
<a href="qbutton.html#5af7e7">clicked()</a> signal to relay clicked() to
the outside world. You can achieve the same effect by connecting the
clicked() signal to a private slot and emitting aSignal() in this slot,
but that takes a few lines of extra code and is not quite as clear, of
course.
<p>A signal can be connected to many slots/signals. Many signals can be
connected to one slot.
<p>If a signal is connected to several slots, the slots are activated
in 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 when it cannot connect the signal to
the slot.
<p>See also <a href="#b146b1">disconnect</a>().
<p>Examples:
<a href="showimg-main-cpp.html#QObject::connect">showimg/main.cpp</a>
<a href="action-main-cpp.html#connect">action/main.cpp</a>
<a href="iconview-main-cpp.html#QObject::connect">iconview/main.cpp</a>
<a href="grapher-grapher-cpp.html#connect">grapher/grapher.cpp</a>
<a href="xform-xform-cpp.html#connect">xform/xform.cpp</a>
<a href="application-main-cpp.html#connect">application/main.cpp</a>
<a href="helpviewer-main-cpp.html#QObject::connect">helpviewer/main.cpp</a>
<a href="i18n-main-cpp.html#QObject::connect">i18n/main.cpp</a>
<a href="drawdemo-drawdemo-cpp.html#connect">drawdemo/drawdemo.cpp</a>
<a href="popup-popup-cpp.html#connect">popup/popup.cpp</a>
<a href="menu-menu-cpp.html#connect">menu/menu.cpp</a>
<a href="qmag-qmag-cpp.html#connect">qmag/qmag.cpp</a>
<a href="qwerty-main-cpp.html#connect">qwerty/main.cpp</a>
<a href="forever-forever-cpp.html#connect">forever/forever.cpp</a>
<a href="rot13-rot13-cpp.html#connect">rot13/rot13.cpp</a>
<a href="scrollview-scrollview-cpp.html#QObject::connect">scrollview/scrollview.cpp</a>
<a href="addressbook-main-cpp.html#connect">addressbook/main.cpp</a>
<a href="movies-main-cpp.html#QObject::connect">movies/main.cpp</a>
<a href="hello-main-cpp.html#QObject::connect">hello/main.cpp</a>
<a href="customlayout-main-cpp.html#connect">customlayout/main.cpp</a>
<a href="mdi-main-cpp.html#connect">mdi/main.cpp</a>
<h3 class="fn">bool<a name="7a8c2f"></a>QObject::connect(constQObject*sender, constchar*signal, constchar*member)const</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<p>Connects <em>signal</em> from the <em>sender</em> object to <em>member</em> in this object.
<p>Equivalent to: <code><a href="#c2d209">QObject::connect</a>(sender, signal, this, member)</code>.
<p>See also <a href="#b146b1">disconnect</a>().
<h3 class="fn">void<a name="5ff2b9"></a>QObject::connectNotify(constchar*signal) <code>[virtualprotected]</code></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>See also <a href="#c2d209">connect</a>() and <a href="#645b79">disconnectNotify</a>().
<p>Reimplemented in <a href="qclipboard.html#8fafb1">QClipboard</a>.
<h3 class="fn">void<a name="2f72ea"></a>QObject::destroyed() <code>[signal]</code></h3>
<p>This signal is emitted immediately before the object is destroyed.
<p>All the objects's children are destroyed immediately after this signal
is emitted.
<h3 class="fn">bool<a name="b146b1"></a>QObject::disconnect(constQObject*sender, constchar*signal, constQObject*receiver, constchar*member) <code>[static]</code></h3>
<p>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>disconnect() is typically used in three ways, as the following examples
show.
<ol>
<li> Disconnect everything connected to an object's signals:
<pre> disconnect( myObject, 0, 0, 0 );
</pre>
<p>equivalent to the non-static overloaded function
<pre> myObject->disconnect();
</pre>
<li> Disconnect everything connected to a specific signal:
<pre> disconnect( myObject, SIGNAL(mySignal()), 0, 0 );
</pre>
<p>equivalent to the non-static overloaded function
<pre> myObject->disconnect( SIGNAL(mySignal()) );
</pre>
<li> Disconnect a specific receiver.
<pre> disconnect( myObject, 0, myReceiver, 0 );
</pre>
<p>equivalent to the non-static overloaded function
<pre> myObject->disconnect( myReceiver );
</pre>
<p></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.)
<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>See also <a href="#c2d209">connect</a>().
<h3 class="fn">bool<a name="86a5c4"></a>QObject::disconnect(constQObject*receiver, constchar*member=0)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<p>Disconnects all signals in this object 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="7fa847"></a>QObject::disconnect(constchar*signal=0, constQObject*receiver=0, constchar*member=0)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<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">void<a name="645b79"></a>QObject::disconnectNotify(constchar*signal) <code>[virtualprotected]</code></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>See also <a href="#b146b1">disconnect</a>() and <a href="#5ff2b9">connectNotify</a>().
<h3 class="fn">void<a name="57f1a6"></a>QObject::dumpObjectInfo()</h3>
<p>Dumps information about signal connections etc. for this object to the
debug output.
<p>This function is useful for debugging. This function does nothing if
the library has been compiled in release mode (i.e without debugging
information).
<h3 class="fn">void<a name="af854e"></a>QObject::dumpObjectTree()</h3>
<p>Dumps a tree of children to the debug output.
<p>This function is useful for debugging. This function does nothing if
the library has been compiled in release mode (i.e without debugging
information).
<h3 class="fn">bool<a name="c8b023"></a>QObject::event(<a href="qevent.html">QEvent</a>*e) <code>[virtual]</code></h3>
<p>This virtual function receives events to an object and should return
TRUE if the event was recognized and processed.
<p>The event() function can be reimplemented to customize the behavior of
an object.
<p>See also <a href="#b59963">installEventFilter</a>(), <a href="#cc83af">timerEvent</a>(), <a href="qapplication.html#5a43f0">QApplication::sendEvent</a>(), <a href="qapplication.html#552386">QApplication::postEvent</a>() and <a href="qwidget.html#f30772">QWidget::event</a>().
<p>Reimplemented in <a href="qsplitter.html#483992">QSplitter</a>, <a href="qtoolbar.html#e3e456">QToolBar</a>, <a href="qclipboard.html#54df16">QClipboard</a>, <a href="qsocketnotifier.html#e1357f">QSocketNotifier</a>, <a href="qstatusbar.html#34e76a">QStatusBar</a>, <a href="qmainwindow.html#7568fa">QMainWindow</a>, <a href="qlineedit.html#e27201">QLineEdit</a>, <a href="qgroupbox.html#b0a10f">QGroupBox</a>, <a href="qtimer.html#94406f">QTimer</a>, <a href="qmultilineedit.html#4e5edd">QMultiLineEdit</a> and <a href="qwidget.html#f30772">QWidget</a>.
<h3 class="fn">bool<a name="bb8547"></a>QObject::eventFilter(QObject*, <a href="qevent.html">QEvent</a>*) <code>[virtual]</code></h3>
<p>Filters events if this object has been installed as an event filter for
another object.
<p>The reimplementation of this virtual function must return TRUE if the
event should be stopped, or FALSE if the event should be dispatched normally.<p><b>Warning:</b> If you delete the receiver object in this function, be sure to return TRUE.
If you return FALSE, Qt sends the event to the deleted object and the
program will crash.
<p>See also <a href="#b59963">installEventFilter</a>().
<p>Reimplemented in <a href="qscrollview.html#0ac2b8">QScrollView</a>, <a href="qtoolbar.html#680d2d">QToolBar</a>, <a href="qmainwindow.html#cc031a">QMainWindow</a>, <a href="qtabwidget.html#92e551">QTabWidget</a>, <a href="qfontdialog.html#224fd0">QFontDialog</a>, <a href="qfiledialog.html#ff0700">QFileDialog</a>, <a href="qspinbox.html#e69a3c">QSpinBox</a>, <a href="qlayout.html#d4f527">QLayout</a>, <a href="qsgistyle.html#bc36f8">QSGIStyle</a>, <a href="qaccel.html#01f967">QAccel</a>, <a href="qlistview.html#981566">QListView</a>, <a href="qcombobox.html#f75507">QComboBox</a>, <a href="qtable.html#73c113">QTable</a>, <a href="qworkspace.html#8fa936">QWorkspace</a>, <a href="qmotifplusstyle.html#ad4cab">QMotifPlusStyle</a>, <a href="qiconview.html#f0abe4">QIconView</a>, <a href="qmenubar.html#90adf4">QMenuBar</a> and <a href="qwizard.html#0011bd">QWizard</a>.
<h3 class="fn">bool<a name="78bb25"></a>QObject::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 list of children,
on the assumption that they will be referenced very often.
<h3 class="fn">bool<a name="ac17a9"></a>QObject::inherits(constchar*clname)const</h3>
<p>Returns TRUE if this object is an instance of a class that inherits
<em>clname,</em> and <em>clname</em> inherits QObject.
<p>(A class is considered to inherit itself.)
<p>Example:
<pre> <a href="qtimer.html">QTimer</a> *t = new <a href="qtimer.html">QTimer</a>; // QTimer inherits QObject
t-><a href="#ac17a9">inherits</a>("QTimer"); // returns TRUE
t-><a href="#ac17a9">inherits</a>("QObject"); // returns TRUE
t-><a href="#ac17a9">inherits</a>("QButton"); // returns FALSE
<a href="qscrollbar.html">QScrollBar</a> * s = new <a href="qscrollbar.html">QScrollBar</a>; // inherits QWidget and QRangeControl
s-><a href="#ac17a9">inherits</a>( "QWidget" ); // returns TRUE
s-><a href="#ac17a9">inherits</a>( "QRangeControl" ); // returns FALSE
</pre>
<p>See also <a href="#67dab2">isA</a>() and <a href="#6a902d">metaObject</a>().
<h3 class="fn">void<a name="a6b8c8"></a>QObject::initMetaObject() <code>[virtualprotected]</code></h3>
<p>Initializes the <a href="#6a902d">meta object</a> of this
object. This method is automatically executed on demand.
<p>See also <a href="#6a902d">metaObject</a>().
<h3 class="fn">void<a name="6fcced"></a>QObject::insertChild(QObject*obj) <code>[virtual]</code></h3>
<p>Inserts an object <em>obj</em> into the list of child objects.<p><b>Warning:</b> This function cannot be used to make a widget a child
widget of another. Child widgets can be created only by setting the
parent widget in the constructor or by calling <a href="qwidget.html#0589b7">QWidget::reparent</a>().
<p>See also <a href="#eb9b06">removeChild</a>() and <a href="qwidget.html#0589b7">QWidget::reparent</a>().
<h3 class="fn">void<a name="b59963"></a>QObject::installEventFilter(constQObject*obj)</h3>
<p>Installs an event filter <em>obj</em> for this object.
<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>obj</em> receives events via its <a href="#bb8547">eventFilter</a>()
function. The eventFilter() function must return TRUE if the event
should be stopped, or FALSE if the event should be dispatched normally.
<p>If multiple event filters are installed for a single object, the
filter that was installed last is activated first.
<p>Example:
<pre> #include <qwidget.h>
class MyWidget : public QWidget
{
public:
MyWidget::MyWidget( <a href="qwidget.html">QWidget</a> *parent=0, const char *name=0 );
protected:
bool eventFilter( <a href="qobject.html">QObject</a> *, QEvent * );
};
MyWidget::MyWidget( <a href="qwidget.html">QWidget</a> *parent, const char *name )
: <a href="qwidget.html">QWidget</a>( parent, name )
{
if ( parent ) // has a parent widget
parent-><a href="#b59963">installEventFilter</a>( this ); // then install filter
}
bool MyWidget::eventFilter( <a href="qobject.html">QObject</a> *o, QEvent *e )
{
if ( e->type() == QEvent::KeyPress ) { // key press
<a href="qkeyevent.html">QKeyEvent</a> *k = (<a href="qkeyevent.html">QKeyEvent</a>*)e;
<a href="qapplication.html#3db6b2">qDebug</a>( "Ate key press %d", k-><a href="qkeyevent.html#a0a881">key</a>() );
return TRUE; // eat event
}
return QWidget::eventFilter( o, e ); // standard event processing
}
</pre>
<p>The <a href="qaccel.html">QAccel</a> class, for example, uses this technique.<p><b>Warning:</b> If you delete the receiver object in your eventFilter() function, be
sure to return TRUE. If you return FALSE, Qt sends the event to the
deleted object and the program will crash.
<p>See also <a href="#f8855d">removeEventFilter</a>(), <a href="#bb8547">eventFilter</a>() and <a href="#c8b023">event</a>().
<h3 class="fn">bool<a name="67dab2"></a>QObject::isA(constchar*clname)const</h3>
<p>Returns TRUE if this object is an instance of a specified class,
otherwise FALSE.
<p>Example:
<pre> <a href="qtimer.html">QTimer</a> *t = new <a href="qtimer.html">QTimer</a>; // QTimer inherits QObject
t-><a href="#67dab2">isA</a>("QTimer"); // returns TRUE
t-><a href="#67dab2">isA</a>("QObject"); // returns FALSE
</pre>
<p>See also <a href="#ac17a9">inherits</a>() and <a href="#6a902d">metaObject</a>().
<h3 class="fn">bool<a name="cf6203"></a>QObject::isWidgetType()const</h3>
<p>Returns TRUE if the object is a widget, or FALSE if not.
<p>Calling this function is equivalent to calling <a href="#ac17a9">inherits</a>("<a href="qwidget.html">QWidget</a>"),
except that it is much faster.
<h3 class="fn">void<a name="f5e328"></a>QObject::killTimer(intid)</h3>
<p>Kills the timer with the identifier <em>id.</em>
<p>The timer identifier is returned by <a href="#906d99">startTimer</a>() when a timer event is
started.
<p>See also <a href="#cc83af">timerEvent</a>(), <a href="#906d99">startTimer</a>() and <a href="#66592d">killTimers</a>().
<p>Examples:
<a href="grapher-grapher-cpp.html#killTimer">grapher/grapher.cpp</a>
<h3 class="fn">void<a name="66592d"></a>QObject::killTimers()</h3>
<p>Kills all timers that this object has started.
<p>Note that 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. Therefore, we recommend
using a <a href="qtimer.html">QTimer</a>, or perhaps <a href="#f5e328">killTimer</a>().
<p>See also <a href="#cc83af">timerEvent</a>(), <a href="#906d99">startTimer</a>() and <a href="#f5e328">killTimer</a>().
<p>Examples:
<a href="xform-xform-cpp.html#killTimers">xform/xform.cpp</a>
<a href="qmag-qmag-cpp.html#killTimers">qmag/qmag.cpp</a>
<h3 class="fn"><a href="qmetaobject.html">QMetaObject</a>*<a name="6a902d"></a>QObject::metaObject()const <code>[virtual]</code></h3>
<p>Returns a pointer to the meta object of this object.
<p>A meta object contains information about a class that inherits
QObject: class name, super class name, properties, signals and
slots. Every class that contains the <code>Q_OBJECT</code> macro will also
have a meta object.
<p>The meta object information is required by the signal/slot
connection mechanism and the property system. The functions <a href="#67dab2">isA</a>()
and <a href="#ac17a9">inherits</a>() also make use of the meta object.
<h3 class="fn">constchar*<a name="b47f73"></a>QObject::name()const</h3>
<p>Returns the name of this object. If the object does not have a name,
it will return "unnamed", so that printf() (used in <a href="qapplication.html#3db6b2">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 <a href="#6f3030">name</a>( 0 ).
<p><pre> <a href="qapplication.html#3db6b2">qDebug</a>( "MyClass::setPrecision(): (%s) unable to set precision to %f",
name(), newPrecision );
</pre>
<p>The object name is set by the constructor or by the <a href="#f80913">setName</a>()
function. The object name is not very useful in the current version
of Qt, but will become increasingly important in the future.
<p>You can find an object by name (and type) using <a href="#f255f5">child</a>(), and more
than one using <a href="#fd1a0e">queryList</a>().
<p>See also <a href="#f80913">setName</a>(), <a href="#421b72">className</a>(), <a href="#f255f5">child</a>() and <a href="#fd1a0e">queryList</a>().
<h3 class="fn">constchar*<a name="6f3030"></a>QObject::name(constchar*defaultName)const</h3>
<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">QCString</a><a name="0786f6"></a>QObject::normalizeSignalSlot(constchar*signalSlot) <code>[staticprotected]</code></h3>
<p>Normlizes the signal or slot definition <em>signalSlot</em> by removing
unnecessary whitespaces.
<h3 class="fn">constQObjectList*<a name="08fff2"></a>QObject::objectTrees() <code>[static]</code></h3>
<p>Returns a pointer to the list of all object trees (respectively
their root objects), or 0 if there are no objects.
<p>The QObjectList class is defined in the qobjcoll.h header file.
<p>The latest root object created is the <a href="qlist.html#df743c">first</a> object in the list and the first root object added is
the <a href="qlist.html#74dca3">last</a> object in the list.
<p>See also <a href="#9026ce">children</a>(), <a href="#1b27d2">parent</a>(), <a href="#6fcced">insertChild</a>() and <a href="#eb9b06">removeChild</a>().
<h3 class="fn">QObject*<a name="1b27d2"></a>QObject::parent()const</h3>
<p>Returns a pointer to the parent object.
<p>See also <a href="#9026ce">children</a>().
<h3 class="fn"><a href="qvariant.html">QVariant</a><a name="d1c761"></a>QObject::property(constchar*name)const</h3>
<p>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="#6a902d">metaObject</a>().
<p>See also <a href="#f5fc85">setProperty</a>(), <a href="qvariant.html#83b746">QVariant::isValid</a>(), <a href="#6a902d">metaObject</a>(), <a href="qmetaobject.html#d6f94c">QMetaObject::propertyNames</a>() and <a href="qmetaobject.html#20d1ee">QMetaObject::property</a>().
<h3 class="fn">QObjectList*<a name="fd1a0e"></a>QObject::queryList(constchar*inheritsClass=0, constchar*objName=0, boolregexpMatch=TRUE, boolrecursiveSearch=TRUE)</h3>
<p>Searches the children and optinally grandchildren of this object,
and returns a list of those objects that are named or matches <em>objName</em> and inherit <em>ineritsClass.</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 regexp that
the objects's names must match. If <em>regexpMatch</em> is FALSE, <em>objName</em> is a string and object names must match it exactly.
<p>Note that <em>ineritsClass</em> uses single inheritance from QObject, the
way <a href="#ac17a9">inherits</a>() does. According to inherits(), <a href="qmenubar.html">QMenuBar</a> inherits
<a href="qwidget.html">QWidget</a> but not <a href="qmenudata.html">QMenuData</a>. This does not quite match reality, but is
the best that can be done on the wide variety of compilers Qt
supports.
<p>Finally, if <em>recursiveSearch</em> is TRUE (the default), queryList()
searches nth-generation as well as first-generation children.
<p>If all this seems a bit complex for your needs, the simpler function
<a href="#f255f5">child</a>() may be what you want.
<p>This somewhat contrived example disables all the buttons in this
window:
<pre> QObjectList * l = topLevelWidget()->queryList( "QButton" );
QObjectListIt it( *l ); // iterate over the buttons
<a href="qobject.html">QObject</a> * obj;
while ( (obj=it.current()) != 0 ) { // for each found object...
++it;
((<a href="qbutton.html">QButton</a>*)obj)->setEnabled( FALSE );
}
delete l; // delete the list, not the objects
</pre>
<p><b>Warning:</b> Delete the list away 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>See also <a href="#f255f5">child</a>(), <a href="#9026ce">children</a>(), <a href="#1b27d2">parent</a>(), <a href="#ac17a9">inherits</a>(), <a href="#6f3030">name</a>() and <a href="qregexp.html">QRegExp</a>.
<h3 class="fn">QConnectionList*<a name="d485d7"></a>QObject::receivers(constchar*signal)const <code>[protected]</code></h3>
<p>Returns a list of objects/slot pairs that are connected to the
signal, or 0 if nothing is connected to it.
<p>This function is for internal use.
<h3 class="fn">void<a name="eb9b06"></a>QObject::removeChild(QObject*obj) <code>[virtual]</code></h3>
<p>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>See also <a href="#6fcced">insertChild</a>() and <a href="qwidget.html#0589b7">QWidget::reparent</a>().
<p>Reimplemented in <a href="qscrollview.html#cd32ca">QScrollView</a>.
<h3 class="fn">void<a name="f8855d"></a>QObject::removeEventFilter(constQObject*obj)</h3>
<p>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="#bb8547">eventFilter</a>() function).
<p>See also <a href="#b59963">installEventFilter</a>(), <a href="#bb8547">eventFilter</a>() and <a href="#c8b023">event</a>().
<h3 class="fn">constQObject*<a name="2b5d74"></a>QObject::sender() <code>[protected]</code></h3>
<p>Returns a pointer to the object that sent the signal, if called in a
slot before any function call or signal emission. Returns an
undefined value in all other cases.<p><b>Warning:</b> This function will return something apparently correct in
other cases as well. However, its value may change during any function
call, depending on what signal-slot connections are activated during
that call. In Qt 3.0 the value will change more often than in 2.x.<p><b>Warning:</b> This function violates the object-oriented principle of modularity,
However, getting access to the sender might be practical 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="f80913"></a>QObject::setName(constchar*name) <code>[virtual]</code></h3>
<p>Sets the name of this object to <em>name.</em> The default name is the
one assigned by the constructor.
<p>You can find an object by name (and type) using <a href="#f255f5">child</a>(), and more
than one using <a href="#fd1a0e">queryList</a>().
<p>See also <a href="#6f3030">name</a>(), <a href="#421b72">className</a>(), <a href="#fd1a0e">queryList</a>() and <a href="#f255f5">child</a>().
<p>Reimplemented in <a href="qwidget.html#9e8a94">QWidget</a> and <a href="qsignal.html#9dc146">QSignal</a>.
<h3 class="fn">bool<a name="f5fc85"></a>QObject::setProperty(constchar*name, const<a href="qvariant.html">QVariant</a>&value)</h3>
<p>Sets the object's property <em>name</em> to <em>value.</em>
<p>Returne TRUE is the operation was successful, FALSE otherwise.
<p>Information about all available properties are provided through the
<a href="#6a902d">metaObject</a>().
<p>See also <a href="#d1c761">property</a>(), <a href="#6a902d">metaObject</a>(), <a href="qmetaobject.html#d6f94c">QMetaObject::propertyNames</a>() and <a href="qmetaobject.html#20d1ee">QMetaObject::property</a>().
<h3 class="fn">bool<a name="a974a8"></a>QObject::signalsBlocked()const</h3>
<p>Returns TRUE if signals are blocked, or FALSE if signals are not blocked.
<p>Signals are not blocked by default.
<p>See also <a href="#b92444">blockSignals</a>().
<h3 class="fn">int<a name="906d99"></a>QObject::startTimer(intinterval)</h3>
<p>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="#f5e328">killTimer</a>() or <a href="#66592d">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="#cc83af">timerEvent</a>() function is called with the <a href="qtimerevent.html">QTimerEvent</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#64f46c">QTimerEvent::timerId</a>() can be
used to find out which timer was activated.
<p>Example:
<pre> class MyObject : public QObject
{
public:
MyObject( <a href="qobject.html">QObject</a> *parent=0, const char *name=0 );
protected:
void timerEvent( <a href="qtimerevent.html">QTimerEvent</a> * );
};
MyObject::MyObject( <a href="qobject.html">QObject</a> *parent, const char *name )
: <a href="qobject.html">QObject</a>( parent, name )
{
<a href="#906d99">startTimer</a>( 50 ); // 50 millisecond timer
<a href="#906d99">startTimer</a>( 1000 ); // 1 second timer
<a href="#906d99">startTimer</a>( 60000 ); // 1 minute timer
}
void MyObject::timerEvent( <a href="qtimerevent.html">QTimerEvent</a> *e )
{
<a href="qapplication.html#3db6b2">qDebug</a>( "timer event, id=%d", e-><a href="qtimerevent.html#64f46c">timerId</a>() );
}
</pre>
<p>There is practically no upper limit for the interval value (more than
one year). The accuracy depends on the underlying operating system.
Windows 95 has 55 millisecond (18.2 times per second) accuracy; other
systems that we have tested (UNIX X11, Windows NT and OS/2) can
handle 1 millisecond intervals.
<p>The <a href="qtimer.html">QTimer</a> class provides a high-level programming interface with
one-shot timers and timer signals instead of events.
<p>See also <a href="#cc83af">timerEvent</a>(), <a href="#f5e328">killTimer</a>() and <a href="#66592d">killTimers</a>().
<p>Examples:
<a href="qmag-qmag-cpp.html#startTimer">qmag/qmag.cpp</a>
<a href="forever-forever-cpp.html#startTimer">forever/forever.cpp</a>
<h3 class="fn"><a href="qmetaobject.html">QMetaObject</a>*<a name="3b1389"></a>QObject::staticMetaObject() <code>[staticprotected]</code></h3>
<p>The functionality of <a href="#a6b8c8">initMetaObject</a>(), provided as a static function.
<h3 class="fn"><a href="qstringlist.html">QStringList</a><a name="ce5d13"></a>QObject::superClasses(boolincludeThis=FALSE)const</h3>
<p><b>This function is obsolete.</b> It is provided to keep old source working, and will probably be removed in a future version of Qt. We strongly advise against using it in new code.<p>
<p>This function is misleadingly named, and cannot be implemented in a
way that fulfills its name. someQWidget->superClasses() should have
returned <a href="qpaintdevice.html">QPaintDevice</a> and QObject, obviously. And it never can, so
let us kill the function. <strong>It will be removed in Qt-3.0</strong>
<p>Oh, and the return type was wrong, too. <a href="qstringlist.html">QStringList</a> not <a href="qstrlist.html">QStrList</a>.
<h3 class="fn">void<a name="cc83af"></a>QObject::timerEvent(<a href="qtimerevent.html">QTimerEvent</a>*) <code>[virtualprotected]</code></h3>
<p>This event handler can be reimplemented in a subclass to receive
timer events for the object.
<p><a href="qtimer.html">QTimer</a> provides a higher-level interface to the timer functionality,
and also more general information about timers.
<p>See also <a href="#906d99">startTimer</a>(), <a href="#f5e328">killTimer</a>(), <a href="#66592d">killTimers</a>() and <a href="#c8b023">event</a>().
<p>Reimplemented in <a href="qpopupmenu.html#3ff1d5">QPopupMenu</a> and <a href="qmultilineedit.html#0cf52b">QMultiLineEdit</a>.
<h3 class="fn"><a href="qstring.html">QString</a><a name="ba30fb"></a>QObject::tr(constchar*text, constchar*comment) <code>[static]</code></h3>
<p>Returns a translated version of <em>text</em> in context QObject and and
with <em>comment,</em> or <em>text</em> if there is no appropriate translated
version. All QObject subclasses which use the Q_OBJECT macro have a
reimplementation of this function which uses the relevant class name
as context.
<p>See also <a href="qapplication.html#471fe3">QApplication::translate</a>().
<h3 class="fn"><a href="qstring.html">QString</a><a name="44b4c1"></a>QObject::tr(constchar*text) <code>[static]</code></h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<p>Returns a translated version of <em>text</em> in context QObject and with
no comment, or <em>text</em> if there is no appropriate translated
version. All QObject subclasses which use the Q_OBJECT macro have a
reimplementation of this function which uses the relevant class name
as context.
<p>See also <a href="qapplication.html#471fe3">QApplication::translate</a>().
<h3 class="fn">bool<a name="9140f4"></a>QObject::activate_filters(<a href="qevent.html">QEvent</a>*e) <code>[protected]</code></h3>
<p>For internal use only.
<h3 class="fn">void<a name="440e00"></a>QObject::activate_signal(constchar*signal) <code>[protected]</code></h3>
<p>For internal use only.
<hr><h2>Related Functions</h2>
<h3>void * <a name="487bf1"></a>qt_find_obj_child (QObject * parent, const char * type, const char * name)</h3>
<p>Returns a pointer to the child named <em>name</em> of QObject <em>parent</em>
which inherits type <em>type.</em>
<p>Returns 0 if there is no such child.
<p><pre> <a href="qlistbox.html">QListBox</a> * c = (<a href="qlistbox.html">QListBox</a> *)::qt_find_obj_child(myWidget,QListBox,
"listboxname");
if ( c )
c-><a href="qlistbox.html#1527aa">insertItem</a>( "another string" );
</pre>
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.1"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2000
<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 2000 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.1</div>
</table></div></address></body></html>
|