Eneboo - Documentación para desarrolladores
src/qt/include/qobject.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qobject.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of QObject class
00005 **
00006 ** Created : 930418
00007 **
00008 ** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
00009 **
00010 ** This file is part of the kernel module of the Qt GUI Toolkit.
00011 **
00012 ** This file may be distributed under the terms of the Q Public License
00013 ** as defined by Trolltech ASA of Norway and appearing in the file
00014 ** LICENSE.QPL included in the packaging of this file.
00015 **
00016 ** This file may be distributed and/or modified under the terms of the
00017 ** GNU General Public License version 2 as published by the Free Software
00018 ** Foundation and appearing in the file LICENSE.GPL included in the
00019 ** packaging of this file.
00020 **
00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
00022 ** licenses may use this file in accordance with the Qt Commercial License
00023 ** Agreement provided with the Software.
00024 **
00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00027 **
00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00029 **   information about Qt Commercial License Agreements.
00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00032 **
00033 ** Contact info@trolltech.com if any conditions of this licensing are
00034 ** not clear to you.
00035 **
00036 **********************************************************************/
00037 
00038 #ifndef QOBJECT_H
00039 #define QOBJECT_H
00040 
00041 #ifndef QT_H
00042 #include "qobjectdefs.h"
00043 #include "qwindowdefs.h"
00044 #include "qstring.h"
00045 #include "qevent.h"
00046 #include "qnamespace.h"
00047 #endif // QT_H
00048 
00049 #define QT_TR_NOOP(x) (x)
00050 #define QT_TRANSLATE_NOOP(scope,x) (x)
00051 
00052 class QMetaObject;
00053 class QVariant;
00054 class QMetaProperty;
00055 class QPostEventList;
00056 class QSenderObjectList;
00057 class QObjectPrivate;
00058 #ifndef QT_NO_USERDATA
00059 class QObjectUserData;
00060 #endif
00061 struct QUObject;
00062 
00063 class Q_EXPORT QObject: public Qt
00064 {
00065     Q_OBJECT
00066     Q_PROPERTY( QCString name READ name WRITE setName )
00067 
00068 public:
00069     QObject( QObject *parent=0, const char *name=0 );
00070     virtual ~QObject();
00071 
00072 #ifdef Q_QDOC
00073     virtual const char *className() const;
00074     static QString tr( const char *, const char * );
00075     static QString trUtf8( const char *, const char * );
00076     virtual QMetaObject *metaObject() const;
00077 #endif
00078 
00079     virtual bool event( QEvent * );
00080     virtual bool eventFilter( QObject *, QEvent * );
00081 
00082     bool         isA( const char * )     const;
00083     bool         inherits( const char * ) const;
00084 
00085     const char  *name() const;
00086     const char  *name( const char * defaultName ) const;
00087 
00088     virtual void setName( const char *name );
00089     bool         isWidgetType()   const { return isWidget; }
00090     bool         highPriority()   const { return FALSE; }
00091 
00092     bool         signalsBlocked()  const { return blockSig; }
00093     void         blockSignals( bool b );
00094 
00095     int          startTimer( int interval );
00096     void         killTimer( int id );
00097     void         killTimers();
00098 
00099     QObject           *child( const char *objName, const char *inheritsClass = 0, bool recursiveSearch = TRUE ); //### const in 4.0
00100     const QObjectList *children() const { return childObjects; }
00101 
00102     static const QObjectList *objectTrees();
00103 
00104     QObjectList       *queryList( const char *inheritsClass = 0,
00105                                   const char *objName = 0,
00106                                   bool regexpMatch = TRUE,
00107                                   bool recursiveSearch = TRUE ) const;
00108 
00109     virtual void insertChild( QObject * );
00110     virtual void removeChild( QObject * );
00111 
00112     void         installEventFilter( const QObject * );
00113     void         removeEventFilter( const QObject * );
00114 
00115     static bool  connect( const QObject *sender, const char *signal,
00116                           const QObject *receiver, const char *member );
00117     bool         connect( const QObject *sender, const char *signal,
00118                           const char *member ) const;
00119     static bool  disconnect( const QObject *sender, const char *signal,
00120                              const QObject *receiver, const char *member );
00121     bool         disconnect( const char *signal=0,
00122                              const QObject *receiver=0, const char *member=0 );
00123     bool         disconnect( const QObject *receiver, const char *member=0 );
00124     static void          connectInternal( const QObject *sender, int signal_index,
00125                           const QObject *receiver, int membcode, int member_index );
00126     static bool          disconnectInternal( const QObject *sender, int signal_index,
00127                              const QObject *receiver, int membcode, int member_index );
00128 
00129     void         dumpObjectTree();
00130     void         dumpObjectInfo();
00131 
00132 #ifndef QT_NO_PROPERTIES
00133     virtual bool setProperty( const char *name, const QVariant& value );
00134     virtual QVariant property( const char *name ) const;
00135 #endif // QT_NO_PROPERTIES
00136 #ifdef QT_NO_TRANSLATION
00137     static QString tr( const char *sourceText, const char * = 0);
00138 #ifndef QT_NO_TEXTCODEC
00139     static QString trUtf8( const char *sourceText, const char * = 0);
00140 #endif
00141 #endif //QT_NO_TRANSLATION
00142 
00143 #ifndef QT_NO_USERDATA
00144     static uint registerUserData();
00145     void setUserData( uint id, QObjectUserData* data);
00146     QObjectUserData* userData( uint id ) const;
00147 #endif // QT_NO_USERDATA
00148 
00149 signals:
00150     void         destroyed();
00151     void         destroyed( QObject* obj );
00152 
00153 public:
00154     QObject     *parent() const { return parentObj; }
00155     // ### AbanQ
00156     uint        aqWasDeleted() const { return wasDeleted; }
00157     // ###
00158     
00159 public slots:
00160     void        deleteLater();
00161 
00162 private slots:
00163     void         cleanupEventFilter( QObject* );
00164 
00165 protected:
00166     bool        activate_filters( QEvent * );
00167     QConnectionList *receivers( const char* signal ) const;
00168     QConnectionList *receivers( int signal ) const;
00169     void        activate_signal( int signal );
00170     void        activate_signal( int signal, int );
00171     void        activate_signal( int signal, double );
00172     void        activate_signal( int signal, QString );
00173     void        activate_signal_bool( int signal, bool );
00174     void        activate_signal( QConnectionList *clist, QUObject *o );
00175 
00176     const QObject *sender();
00177 
00178     virtual void timerEvent( QTimerEvent * );
00179     virtual void childEvent( QChildEvent * );
00180     virtual void customEvent( QCustomEvent * );
00181 
00182     virtual void connectNotify( const char *signal );
00183     virtual void disconnectNotify( const char *signal );
00184     virtual bool checkConnectArgs( const char *signal, const QObject *receiver,
00185                                    const char *member );
00186     static QCString normalizeSignalSlot( const char *signalSlot );
00187 
00188 private:
00189     uint        isSignal   : 1;
00190     uint        isWidget   : 1;
00191     uint        pendTimer  : 1;
00192     uint        blockSig   : 1;
00193     uint        wasDeleted : 1;
00194     uint        isTree : 1;
00195 
00196     const char  *objname;
00197     QObject     *parentObj;
00198     QObjectList *childObjects;
00199     QSignalVec *connections;
00200     QSenderObjectList *senderObjects;
00201     QObjectList *eventFilters;
00202     QPostEventList *postedEvents;
00203     QObjectPrivate* d;
00204 
00205     static QMetaObject* staticQtMetaObject();
00206 
00207     friend class QApplication;
00208     friend class QBaseApplication;
00209     friend class QWidget;
00210     friend class QSignal;
00211 
00212 private:        // Disabled copy constructor and operator=
00213 #if defined(Q_DISABLE_COPY)
00214     QObject( const QObject & );
00215     QObject &operator=( const QObject & );
00216 #endif
00217 };
00218 
00219 
00220 #ifndef QT_NO_USERDATA
00221 class Q_EXPORT QObjectUserData {
00222 public:
00223     virtual ~QObjectUserData();
00224 };
00225 #endif
00226 
00227 
00228 inline bool QObject::connect( const QObject *sender, const char *signal,
00229                               const char *member ) const
00230 {
00231     return connect( sender, signal, this, member );
00232 }
00233 
00234 
00235 inline bool QObject::disconnect( const char *signal,
00236                                  const QObject *receiver, const char *member )
00237 {
00238     return disconnect( this, signal, receiver, member );
00239 }
00240 
00241 
00242 inline bool QObject::disconnect( const QObject *receiver, const char *member )
00243 {
00244     return disconnect( this, 0, receiver, member );
00245 }
00246 
00247 
00248 #ifdef QT_NO_TRANSLATION
00249 inline QString QObject::tr( const char *sourceText, const char * ) {
00250     return QString::fromLatin1( sourceText );
00251 }
00252 #ifndef QT_NO_TEXTCODEC
00253 inline QString QObject::trUtf8( const char *sourceText, const char * ) {
00254     return QString::fromUtf8( sourceText );
00255 }
00256 #endif
00257 #endif //QT_NO_TRANSLATION
00258 
00259 
00260 #define Q_DEFINED_QOBJECT
00261 #include "qwinexport.h"
00262 #endif // QOBJECT_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'