⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qobject.3qt

📁 Trolltech公司发布的基于C++图形开发环境
💻 3QT
📖 第 1 页 / 共 3 页
字号:
'\" t.TH QObject 3qt "24 January 2005" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS.  All rights reserved.  See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQObject \- The base class of all Qt objects.br.PP\fC#include <qobject.h>\fR.PPInherits Qt..PPInherited by QAccel, QAction, QApplication, QAuServer, QCanvas, QClipboard, QCopChannel, QDataPump, QDns, QDnsSocket, QDragManager, QDragObject, QFileIconProvider, QGuardedPtrPrivate, QLayout, QNPInstance, QNetworkOperation, QNetworkProtocol, QSenderObject, QServerSocket, QSessionManager, QSignal, QSignalMapper, QSocket, QSocketNotifier, QSound, QStyle, QStyleSheet, QTimer, QToolTipGroup, QTranslator, QUrlOperator, QValidator, QWSClient, QWSGestureMethod, QWSInputMethod, QWSServer and QWidget..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQObject\fR ( QObject * " "parent" "=0, const char * " "name" "=0 ) ".br.ti -1c.BI "virtual \fB~QObject\fR () ".br.ti -1c.BI "virtual bool \fBevent\fR ( QEvent * ) ".br.ti -1c.BI "virtual bool \fBeventFilter\fR ( QObject *, QEvent * ) ".br.ti -1c.BI "virtual QMetaObject* \fBmetaObject\fR () const".br.ti -1c.BI "virtual const char* \fBclassName\fR () const".br.ti -1c.BI "bool \fBisA\fR ( const char * ) const".br.ti -1c.BI "bool \fBinherits\fR ( const char * ) const".br.ti -1c.BI "const char* \fBname\fR () const".br.ti -1c.BI "const char* \fBname\fR ( const char * defaultName ) const".br.ti -1c.BI "virtual void \fBsetName\fR ( const char * name ) ".br.ti -1c.BI "bool \fBisWidgetType\fR () const".br.ti -1c.BI "bool \fBhighPriority\fR () const".br.ti -1c.BI "bool \fBsignalsBlocked\fR () const".br.ti -1c.BI "void \fBblockSignals\fR ( bool b ) ".br.ti -1c.BI "int \fBstartTimer\fR ( int interval ) ".br.ti -1c.BI "void \fBkillTimer\fR ( int id ) ".br.ti -1c.BI "void \fBkillTimers\fR () ".br.ti -1c.BI "QObject* \fBchild\fR ( const char * " "name" ", const char * " "type" " = 0 ) ".br.ti -1c.BI "const QObjectList* \fBchildren\fR () const".br.ti -1c.BI "QObjectList* \fBqueryList\fR ( const char * " "inheritsClass" " = 0, const char * " "objName" " = 0, bool " "regexpMatch" " = TRUE, bool " "recursiveSearch" " = TRUE ) ".br.ti -1c.BI "virtual void \fBinsertChild\fR ( QObject * ) ".br.ti -1c.BI "virtual void \fBremoveChild\fR ( QObject * ) ".br.ti -1c.BI "void \fBinstallEventFilter\fR ( const QObject * ) ".br.ti -1c.BI "void \fBremoveEventFilter\fR ( const QObject * ) ".br.ti -1c.BI "bool \fBconnect\fR ( const QObject * " "sender" ", const char * " "signal" ", const char * member ) const".br.ti -1c.BI "bool \fBdisconnect\fR ( const char * " "signal" "=0, const QObject * " "receiver" "=0, const char * " "member" "=0 ) ".br.ti -1c.BI "bool \fBdisconnect\fR ( const QObject * " "receiver" ", const char * " "member" "=0 ) ".br.ti -1c.BI "void \fBdumpObjectTree\fR () ".br.ti -1c.BI "void \fBdumpObjectInfo\fR () ".br.ti -1c.BI "bool \fBsetProperty\fR ( const char * " "name" ", const QVariant & value ) ".br.ti -1c.BI "QVariant \fBproperty\fR ( const char * name ) const".br.ti -1c.BI "QObject* \fBparent\fR () const".br.ti -1c.BI "QStringList superClasses ( bool " "includeThis" " = FALSE ) const \fI(obsolete)\fR".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBdestroyed\fR () ".br.in -1c.SS "Static Public Members".in +1c.ti -1c.BI "QString \fBtr\fR ( const char * ) ".br.ti -1c.BI "QString \fBtr\fR ( const char *, const char * ) ".br.ti -1c.BI "const QObjectList* \fBobjectTrees\fR () ".br.ti -1c.BI "bool \fBconnect\fR ( const QObject * " "sender" ", const char * " "signal" ", const QObject * " "receiver" ", const char * member ) ".br.ti -1c.BI "bool \fBdisconnect\fR ( const QObject * " "sender" ", const char * " "signal" ", const QObject * " "receiver" ", const char * member ) ".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "bool \fBactivate_filters\fR ( QEvent * ) (internal)".br.ti -1c.BI "QConnectionList* \fBreceivers\fR ( const char * signal ) const".br.ti -1c.BI "void \fBactivate_signal\fR ( const char * signal ) (internal)".br.ti -1c.BI "void \fBactivate_signal\fR ( const char * " "signal" ", short ) ".br.ti -1c.BI "void \fBactivate_signal\fR ( const char * " "signal" ", int ) ".br.ti -1c.BI "void \fBactivate_signal\fR ( const char * " "signal" ", long ) ".br.ti -1c.BI "void \fBactivate_signal\fR ( const char * " "signal" ", const char * ) ".br.ti -1c.BI "void \fBactivate_signal_bool\fR ( const char * " "signal" ", bool ) ".br.ti -1c.BI "void \fBactivate_signal_string\fR ( const char * " "signal" ", QString ) ".br.ti -1c.BI "void \fBactivate_signal_strref\fR ( const char * " "signal" ", const QString & ) ".br.ti -1c.BI "const QObject* \fBsender\fR () ".br.ti -1c.BI "virtual void \fBinitMetaObject\fR () ".br.ti -1c.BI "virtual void \fBtimerEvent\fR ( QTimerEvent * ) ".br.ti -1c.BI "virtual void \fBchildEvent\fR ( QChildEvent * ) ".br.ti -1c.BI "virtual void \fBconnectNotify\fR ( const char * signal ) ".br.ti -1c.BI "virtual void \fBdisconnectNotify\fR ( const char * signal ) ".br.ti -1c.BI "virtual bool \fBcheckConnectArgs\fR ( const char * " "signal" ", const QObject * " "receiver" ", const char * member ) ".br.in -1c.SS "Static Protected Members".in +1c.ti -1c.BI "QMetaObject* \fBstaticMetaObject\fR () ".br.ti -1c.BI "QCString \fBnormalizeSignalSlot\fR ( const char * signalSlot ) ".br.ti -1c.BI "void \fBbadSuperclassWarning\fR ( const char * " "className" ", const char * superclassName ) ".br.in -1c.SH RELATED FUNCTION DOCUMENTATION(Note that these are not member functions.).in +1c.ti -1c.BI "void * \fBqt_find_obj_child\fR (QObject * " "parent" ", const char * " "type" ", const char * " "name" ")".br.in -1c.SS "Properties".nf.TSl l l l l- - - - -l l l l l.Type	Name	READ	WRITE	OptionsQCString	name	name	setName.TE.fi.SH DESCRIPTIONThe QObject class is the base class of all Qt objects..PPQObject is the heart of the Qt object model. The central feature in this model is a very powerful mechanism for seamless object commuinication dubbed signals and slots. With connect(), you can connect a signal to a slot and destroy the connection again with disconnect(). To avoid never-ending notification loops, you can temporarily block signals with blockSignals(). The protected functions connectNotify() and disconnectNotify() make it possible to track connections..PPQObjects organize themselves in object trees. When you create a QObject with another object as parent, it will automatically do an insertChild() on the parent and thus show up in the parent's children() 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 child() or queryList(), and get the list of tree roots using objectTrees()..PPEvery object has an object name() and can report its className() and whether it inherits() another class in the QObject inheritance hierarchy..PPWhen an object is deleted, it emits a destroyed() signal. You can catch this signal to avoid dangling references to QObjects. The QGuardedPtr class provides an elegant way to use this feature..PPQObjects can receive events through event() and filter events of other objects. See installEventFilter() and eventFilter() for details. A convenience handler childEvent() can be reimplemented to catch child events..PPLast but not least, QObject provides the basic timer support in Qt, see QTimer for high-level support for timers..PPNotice that the \fCQ_OBJECT\fR macro is mandatory for any object that implement signals, slots or properties. You also need to run the moc program (Meta Object Compiler) on the source file. We strongly recommend to use the macro in \fIall\fR subclasses of QObject regardless whether they actually use signals, slots and properties or not. Otherwise certain functions can show undefined behaviour..PPAll Qt widgets inherit QObject. The convenience function isWidgetType() returns whether an object is actually a widget. It is much faster than inherits( "QWidget" )..SH MEMBER FUNCTION DOCUMENTATION.SH "QObject::QObject ( QObject * parent=0, const char * name=0 )"Constructs an object with the parent object \fIparent\fR and a \fIname.\fR.PPThe parent of an object may be viewed as the object's owner. For instance, a dialog box is the parent of the" ok" and "cancel" buttons inside it..PPThe destructor of a parent object destroys all child objects..PPSetting \fIparent\fR to 0 constructs an object with no parent. If the object is a widget, it will become a top-level window..PPThe object name is a text that can be used to identify this QObject. It's particularly useful in conjunction with the Qt Designer. You can find an object by name (and type) using child(), and more than one using queryList()..PPSee also parent(), name(), child() and queryList()..SH "QObject::~QObject () \fC[virtual]\fR"Destructs the object, deleting all its child objects..PPAll signals to and from the object are automatically disconnected..PP\fBWarning:\fR \fIAll\fR 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 QObject::destroyed() signal gives you an opportunity to detect when an object is destroyed..SH "void QObject::activate_signal ( const char * signal, const char * ) \fC[protected]\fR"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..SH "void QObject::activate_signal ( const char * signal, int ) \fC[protected]\fR"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..SH "void QObject::activate_signal ( const char * signal, long ) \fC[protected]\fR"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..SH "void QObject::activate_signal ( const char * signal, short ) \fC[protected]\fR"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..SH "void QObject::activate_signal_bool ( const char * signal, bool ) \fC[protected]\fR"For internal use only..SH "void QObject::activate_signal_string ( const char * signal, QString ) \fC[protected]\fR"For internal use only..SH "void QObject::activate_signal_strref ( const char * signal, const QString & ) \fC[protected]\fR"For internal use only..SH "void QObject::badSuperclassWarning ( const char * className, const char * superclassName ) \fC[static protected]\fR"Internal function, called from initMetaObject(). Used to emit a warning when a class containing the macro Q_OBJECT inherits from a class that does not contain it..SH "void QObject::blockSignals ( bool block )"Blocks signals if \fIblock\fR is TRUE, or unblocks signals if \fIblock\fR is FALSE..PPEmitted signals disappear into hyperspace if signals are blocked..SH "bool QObject::checkConnectArgs ( const char * signal, const QObject * receiver, const char * member ) \fC[virtual protected]\fR"Returns TRUE if the \fIsignal\fR and the \fImember\fR arguments are compatible, otherwise FALSE..PP\fBWarning:\fR We recommend that you do not reimplement this function but use the default implementation..SH "QObject* QObject::child ( const char * name, const char * type = 0 )"Searches through the children and grandchildren of this object for an object named \fIname\fR and with type \fItype\fR (or a subclass of that type), and returns a pointer to that object if it exists. If \fItype\fR is 0, any type matches..PPIf there isn't any such object, this function returns null..PPIf there is more than one, one of them is returned; use queryList() if you need all of them..SH "void QObject::childEvent ( QChildEvent * ) \fC[virtual protected]\fR"This event handler can be reimplemented in a subclass to receive child events..PPChild events are sent to objects when children are inserted or removed..PPNote that events with QEvent::type() \fCQEvent::ChildInserted\fR are \fIposted\fR (with QApplication::postEvent()), to make sure that the child's construction is completed before this function is called..PPNote that if a child is removed immediately after it is inserted, the \fCChildInserted\fR event may be suppressed, but the \fCChildRemoved\fR event will always be sent. In this case there will be a \fCChildRemoved\fR event without a corresponding \fCChildInserted\fR event..PPIf you change state based on \fCChildInserted\fR events, call QWidget::constPolish(), or do \fCQApplication::sendPostedEvents( this, QEvent::ChildInserted );\fR in functions that depend on the state. One notable example is QWidget::sizeHint()..PPSee also event() and QChildEvent..PPReimplemented in QGroupBox, QWidgetStack, QWorkspace, QMainWindow and QSplitter..SH "const QObjectList * QObject::children () const"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -