Eneboo - Documentación para desarrolladores
Slots públicos | Señales | Métodos públicos | Métodos públicos estáticos | Métodos protegidos | Métodos protegidos estáticos | Propiedades | Amigas | Funciones relacionadas
Referencia de la Clase QObject

The QObject class is the base class of all Qt objects. Más...

#include <qobject.h>

Diagrama de herencias de QObject
Qt Qt AQObjectQueryList AQS AQSBaseObject AQSql CheckObject CommandHistory ConnectionContainer ConnectionItem EditorBrowser EditorBrowser EditorCompletion EditorCompletion EditorInterfaceImpl FLApplicationInterface FLCodBar FLCodBarInterface FLDigiDocInterface FLDomNodeInterface FLDomNodeListInterface FLFieldDBInterface FLFormDBInterface FLFormRecordDBInterface FLFormSearchDBInterface FLImageViewerInterface FLJasperEngine FLJasperViewer FLListViewInterface FLListViewItemInterface FLNetwork FLPicture FLPosPrinterInterface FLReportPages FLReportViewerInterface FLScriptEditorInterface FLSerialPortInterface FLSmtpClient FLSmtpClientInterface FLSqlCursor FLSqlCursorInterface FLSqlQuery FLSqlQueryInterface FLStaticLoaderWarning FLTableDBInterface FLTableInterface FLTableMetaData FLTabWidgetInterface FLUtilInterface FLVarInterface FormFile Layout ListBoxRename ListDnd MenuBarEditorItem MLineObject MPageCollection MReportEngine MReportObject MReportSection MyObject NormalizeObject NormalizeObject NormalizeObject NormalizeObject opInfo PopupMenuEditorItem Project PropertyBoolItem PropertyColorItem PropertyCoordItem PropertyCursorItem PropertyDatabaseItem PropertyDateItem PropertyDateTimeItem PropertyDoubleItem PropertyEnumItem PropertyFontItem PropertyIntItem PropertyKeysequenceItem PropertyLayoutItem PropertyListItem PropertyObject PropertyPaletteItem PropertyPixmapItem PropertySizePolicyItem PropertyTextItem PropertyTimeItem QAccel QAccel QAction QAction QApplication QApplication QAquaAnimate QAquaAnimate QAssistantClient QAssistantClient QAuServer QAuServer QAuServerMacCleanupHandler QCanvas QCanvas QClipboard QClipboard QColorDialogPrivate QDataPump QDataPump QDns QDns QDnsSocket QDnsSocket QDragManager QDragManager QDragObject QDragObject QEditorFactory QEditorFactory QEventLoop QEventLoop QFileIconProvider QFileIconProvider QFontCache QFontCache QFtpDTP QFtpPI QGPlugin QGPlugin QGuardedPtrPrivate QGuardedPtrPrivate QLayout QLayout QMacAnimateCursor QMoviePrivate QNetworkOperation QNetworkOperation QNetworkProtocol QNetworkProtocol QObjectCleanupHandler QObjectCleanupHandler QPMCache QProcess QProcess QProcessManager QSAEditorInterface QSDateEditEnums QSDir QSDirStatic QSEngine QServerSocket QServerSocket QSessionManager QSessionManager QSFile QSFileDialog QSFileStatic QSharedDoubleBufferCleaner QSignal QSignal QSignalMapper QSignalMapper QSingleShotTimer QSInput QSInterpreter QSMessageBox QSmSocketReceiver QSocket QSocket QSocketNotifier QSocketNotifier QSound QSound QSProcess QSProcessStatic QSProject QSqlDatabase QSqlDatabase QSqlDatabaseManager QSqlDriver QSqlDriver QSqlForm QSqlForm QSqlResultShared QSqlResultShared QSScript QSTimeoutTrigger QStyle QStyle QStyleFactoryPrivate QStyleSheet QStyleSheet QSWidget QSWorkbench QSWrapperSharedWatcher QTextDocument QTextDocument QTimer QTimer QTipManager QToolTipGroup QToolTipGroup QTranslator QTranslator QuickScriptReceiver QuickUnnamedObject QUrlOperator QUrlOperator QValidator QValidator QWhatsThisPrivate QWidget QWidget QWidgetResizeHandler QWidgetResizeHandler QWidgetStackEventFilter QWindowsStyle::Private QwtDesignerPlugin::CustomWidgetCollectionInterface QwtDesignerPlugin::CustomWidgetInterface QwtDesignerPlugin::TaskMenuExtension QwtGuardedPainter QwtMagnifier QwtPicker SenderObject ShortcutHandler Smtp SourceFile TimerObject TimeStamp UibHack

Lista de todos los miembros.

Slots públicos

void deleteLater ()
void deleteLater ()

Señales

void destroyed ()
void destroyed (QObject *obj)
void destroyed ()
void destroyed (QObject *obj)

Métodos públicos

 QObject (QObject *parent=0, const char *name=0)
virtual ~QObject ()
virtual bool event (QEvent *)
virtual bool eventFilter (QObject *, QEvent *)
bool isA (const char *) const
bool inherits (const char *) const
const char * name () const
const char * name (const char *defaultName) const
virtual void setName (const char *name)
bool isWidgetType () const
bool highPriority () const
bool signalsBlocked () const
void blockSignals (bool b)
int startTimer (int interval)
void killTimer (int id)
void killTimers ()
QObjectchild (const char *objName, const char *inheritsClass=0, bool recursiveSearch=TRUE)
const QObjectListchildren () const
QObjectListqueryList (const char *inheritsClass=0, const char *objName=0, bool regexpMatch=TRUE, bool recursiveSearch=TRUE) const
virtual void insertChild (QObject *)
virtual void removeChild (QObject *)
void installEventFilter (const QObject *)
void removeEventFilter (const QObject *)
bool connect (const QObject *sender, const char *signal, const char *member) const
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
bool disconnect (const QObject *receiver, const char *member=0)
void dumpObjectTree ()
void dumpObjectInfo ()
virtual bool setProperty (const char *name, const QVariant &value)
virtual QVariant property (const char *name) const
void setUserData (uint id, QObjectUserData *data)
QObjectUserDatauserData (uint id) const
QObjectparent () const
uint aqWasDeleted () const
 QObject (QObject *parent=0, const char *name=0)
virtual ~QObject ()
virtual bool event (QEvent *)
virtual bool eventFilter (QObject *, QEvent *)
bool isA (const char *) const
bool inherits (const char *) const
const char * name () const
const char * name (const char *defaultName) const
virtual void setName (const char *name)
bool isWidgetType () const
bool highPriority () const
bool signalsBlocked () const
void blockSignals (bool b)
int startTimer (int interval)
void killTimer (int id)
void killTimers ()
QObjectchild (const char *objName, const char *inheritsClass=0, bool recursiveSearch=TRUE)
const QObjectListchildren () const
QObjectListqueryList (const char *inheritsClass=0, const char *objName=0, bool regexpMatch=TRUE, bool recursiveSearch=TRUE) const
virtual void insertChild (QObject *)
virtual void removeChild (QObject *)
void installEventFilter (const QObject *)
void removeEventFilter (const QObject *)
bool connect (const QObject *sender, const char *signal, const char *member) const
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
bool disconnect (const QObject *receiver, const char *member=0)
void dumpObjectTree ()
void dumpObjectInfo ()
virtual bool setProperty (const char *name, const QVariant &value)
virtual QVariant property (const char *name) const
void setUserData (uint id, QObjectUserData *data)
QObjectUserDatauserData (uint id) const
QObjectparent () const
uint aqWasDeleted () const

Métodos públicos estáticos

static const QObjectListobjectTrees ()
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
static void connectInternal (const QObject *sender, int signal_index, const QObject *receiver, int membcode, int member_index)
static bool disconnectInternal (const QObject *sender, int signal_index, const QObject *receiver, int membcode, int member_index)
static uint registerUserData ()
static const QObjectListobjectTrees ()
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
static void connectInternal (const QObject *sender, int signal_index, const QObject *receiver, int membcode, int member_index)
static bool disconnectInternal (const QObject *sender, int signal_index, const QObject *receiver, int membcode, int member_index)
static uint registerUserData ()

Métodos protegidos

bool activate_filters (QEvent *)
QConnectionListreceivers (const char *signal) const
QConnectionListreceivers (int signal) const
void activate_signal (int signal)
void activate_signal (int signal, int)
void activate_signal (int signal, double)
void activate_signal (int signal, QString)
void activate_signal_bool (int signal, bool)
void activate_signal (QConnectionList *clist, QUObject *o)
const QObjectsender ()
virtual void timerEvent (QTimerEvent *)
virtual void childEvent (QChildEvent *)
virtual void customEvent (QCustomEvent *)
virtual void connectNotify (const char *signal)
virtual void disconnectNotify (const char *signal)
virtual bool checkConnectArgs (const char *signal, const QObject *receiver, const char *member)
bool activate_filters (QEvent *)
QConnectionListreceivers (const char *signal) const
QConnectionListreceivers (int signal) const
void activate_signal (int signal)
void activate_signal (int signal, int)
void activate_signal (int signal, double)
void activate_signal (int signal, QString)
void activate_signal_bool (int signal, bool)
void activate_signal (QConnectionList *clist, QUObject *o)
const QObjectsender ()
virtual void timerEvent (QTimerEvent *)
virtual void childEvent (QChildEvent *)
virtual void customEvent (QCustomEvent *)
virtual void connectNotify (const char *signal)
virtual void disconnectNotify (const char *signal)
virtual bool checkConnectArgs (const char *signal, const QObject *receiver, const char *member)

Métodos protegidos estáticos

static QCString normalizeSignalSlot (const char *signalSlot)
static QCString normalizeSignalSlot (const char *signalSlot)

Propiedades

QCString name
 the name of this object

Amigas

class QApplication
class QBaseApplication
class QWidget
class QSignal

Funciones relacionadas

(Observar que estas no son funciones miembro.)

void * qt_find_obj_child (QObject *parent, const char *type, const char *name)

Descripción detallada

The QObject class is the base class of all Qt objects.

QObject is the heart of the Qt object model. The central feature in this model is a very powerful mechanism for seamless object communication called signals and slots . You can connect a signal to a slot with connect() and destroy the connection 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.

QObjects organize themselves in object trees. When you create a QObject with another object as parent, the object will automatically do an insertChild() on the parent and thus show up in the parent's children() 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 child() or queryList(), and get the list of tree roots using objectTrees().

Every object has an object name() and can report its className() and whether it inherits() another class in the QObject inheritance hierarchy.

When 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.

QObjects can receive events through event() and filter the events of other objects. See installEventFilter() and eventFilter() for details. A convenience handler, childEvent(), can be reimplemented to catch child events.

Last but not least, QObject provides the basic timer support in Qt; see QTimer for high-level support for timers.

Notice that the Q_OBJECT macro is mandatory for any object that implements signals, slots or properties. You also need to run the moc program (Meta Object Compiler) on the source file. We strongly recommend the use of this macro in all subclasses of QObject 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.

All Qt widgets inherit QObject. The convenience function isWidgetType() returns whether an object is actually a widget. It is much faster than inherits( "QWidget" ).

Some QObject functions, e.g. children(), objectTrees() and queryList() return a QObjectList. A QObjectList is a QPtrList of QObjects. QObjectLists support the same operations as QPtrLists and have an iterator class, QObjectListIt.


Documentación del constructor y destructor

QObject::QObject ( QObject parent = 0,
const char *  name = 0 
)

Constructs an object called name with parent object, parent.

The 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 it contains.

The destructor of a parent object destroys all child objects.

Setting parent to 0 constructs an object with no parent. If the object is a widget, it will become a top-level window.

The object name is some text that can be used to identify a QObject. It's particularly useful in conjunction with Qt Designer. You can find an object by name (and type) using child(). To find several objects use queryList().

Ver también:
parent(), name(), child(), queryList()
QObject::~QObject ( ) [virtual]

Destroys the object, deleting all its child objects.

All signals to and from the object are automatically disconnected.

Atención:
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 QObject::destroyed() signal gives you an opportunity to detect when an object is destroyed.
Deleting a QObject while pending events are waiting to be delivered can cause a crash. You must not delete the QObject directly from a thread that is not the GUI thread. Use the QObject::deleteLater() method instead, which will cause the event loop to delete the object after all pending events have been delivered to the object.
QObject::QObject ( QObject parent = 0,
const char *  name = 0 
)
virtual QObject::~QObject ( ) [virtual]

Documentación de las funciones miembro

bool QObject::activate_filters ( QEvent e) [protected]
bool QObject::activate_filters ( QEvent ) [protected]
void QObject::activate_signal ( int  signal) [protected]
void QObject::activate_signal ( int  signal,
int   
) [protected]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.

void QObject::activate_signal ( int  signal,
double   
) [protected]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.

void QObject::activate_signal ( int  signal,
QString   
) [protected]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.

void QObject::activate_signal ( QConnectionList clist,
QUObject o 
) [protected]
void QObject::activate_signal ( int  signal) [protected]
void QObject::activate_signal ( int  signal,
int   
) [protected]
void QObject::activate_signal ( int  signal,
double   
) [protected]
void QObject::activate_signal ( int  signal,
QString   
) [protected]
void QObject::activate_signal ( QConnectionList clist,
QUObject o 
) [protected]
void QObject::activate_signal_bool ( int  signal,
bool   
) [protected]
void QObject::activate_signal_bool ( int  signal,
bool   
) [protected]
uint QObject::aqWasDeleted ( ) const [inline]
uint QObject::aqWasDeleted ( ) const [inline]
void QObject::blockSignals ( bool  b)
void QObject::blockSignals ( bool  block)

Blocks signals if block is TRUE, or unblocks signals if block is FALSE.

Emitted signals disappear into hyperspace if signals are blocked. Note that the destroyed() signals will be emitted even if the signals for this object have been blocked.

bool QObject::checkConnectArgs ( const char *  signal,
const QObject receiver,
const char *  member 
) [protected, virtual]

Returns TRUE if the signal and the member arguments are compatible; otherwise returns FALSE. (The receiver argument is currently ignored.)

Atención:
We recommend that you use the default implementation and do not reimplement this function.

TRUE: "signal(<anything>)", "member()" TRUE: "signal(a,b,c)", "member(a,b,c)" TRUE: "signal(a,b,c)", "member(a,b)", "member(a)" etc. FALSE: "signal(const a)", "member(a)" FALSE: "signal(a)", "member(const a)" FALSE: "signal(a)", "member(b)" FALSE: "signal(a)", "member(a,b)"

virtual bool QObject::checkConnectArgs ( const char *  signal,
const QObject receiver,
const char *  member 
) [protected, virtual]
QObject* QObject::child ( const char *  objName,
const char *  inheritsClass = 0,
bool  recursiveSearch = TRUE 
)
QObject * QObject::child ( const char *  objName,
const char *  inheritsClass = 0,
bool  recursiveSearch = TRUE 
)

Searches the children and optionally grandchildren of this object, and returns a child that is called objName that inherits inheritsClass. If inheritsClass is 0 (the default), any class matches.

If recursiveSearch is TRUE (the default), child() performs a depth-first search of the object's children.

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 queryList().

void QObject::childEvent ( QChildEvent ) [protected, virtual]

This event handler can be reimplemented in a subclass to receive child events.

Child events are sent to objects when children are inserted or removed.

Note that events with QEvent::type() QEvent::ChildInserted are posted (with {QApplication::postEvent()}) to make sure that the child's construction is completed before this function is called.

If a child is removed immediately after it is inserted, the ChildInserted event may be suppressed, but the ChildRemoved event will always be sent. In such cases it is possible that there will be a ChildRemoved event without a corresponding ChildInserted event.

If you change state based on ChildInserted events, call QWidget::constPolish(), or do

in functions that depend on the state. One notable example is QWidget::sizeHint().

Ver también:
event(), QChildEvent

Reimplementado en ViewManager, QActionGroup, QGroupBox, QLayout, QMainWindow, QSplitter, QWidgetStack, QWorkspace, QLayout, QActionGroup, QGroupBox, QHideDock, QMainWindow, QSplitter, QWidgetStack, QWorkspaceChild, QWorkspace y ViewManager.

virtual void QObject::childEvent ( QChildEvent ) [protected, virtual]
const QObjectList* QObject::children ( ) const [inline]
const QObjectList * QObject::children ( ) const [inline]

Returns a list of child objects, or 0 if this object has no children.

The QObjectList class is defined in the qobjectlist.h header file.

The first child added is the first object in the list and the last child added is the last object in the list, i.e. new children are appended at the end.

Note that the list order changes when QWidget children are raised or lowered. 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.

Ver también:
child(), queryList(), parent(), insertChild(), removeChild()

Reimplementado en QuickInterpreter, QTextDocument y QTextDocument.

static bool QObject::connect ( const QObject sender,
const char *  signal,
const QObject receiver,
const char *  member 
) [static]
bool QObject::connect ( const QObject sender,
const char *  signal,
const char *  member 
) const
bool QObject::connect ( const QObject sender,
const char *  signal,
const QObject receiver,
const char *  member 
) [static]

Connects signal from the sender object to member in object receiver, and returns TRUE if the connection succeeds; otherwise returns FALSE.

You must use the SIGNAL() and SLOT() macros when specifying the signal and the member, for example:

    QLabel     *label  = new QLabel;
    QScrollBar *scroll = new QScrollBar;
    QObject::connect( scroll, SIGNAL(valueChanged(int)),
                      label,  SLOT(setNum(int)) );

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: QObject::connect( scroll, SIGNAL(valueChanged(int v)), label, SLOT(setNum(int v)) );

A signal can also be connected to another signal:

    class MyWidget : public QWidget
    {
        Q_OBJECT
    public:
        MyWidget();

    signals:
        void myUsefulSignal();

    private:
        QPushButton *aButton;
    };

    MyWidget::MyWidget()
    {
        aButton = new QPushButton( this );
        connect( aButton, SIGNAL(clicked()), SIGNAL(myUsefulSignal()) );
    }

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.

A signal can be connected to many slots and signals. Many signals can be connected to one slot.

If a signal is connected to several slots, the slots are activated in an arbitrary order when the signal is emitted.

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 QObject is unable to verify the existence of either signal or member, or if their signatures aren't compatible.

A signal is emitted for {every} connection you make, so if you duplicate a connection, two signals will be emitted. You can always break a connection using {disconnect()}.

Ver también:
disconnect()
bool QObject::connect ( const QObject sender,
const char *  signal,
const char *  member 
) const [inline]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.

Connects signal from the sender object to this object's member.

Equivalent to: {QObject::connect(sender, signal, this, member)}.

Ver también:
disconnect()
static void QObject::connectInternal ( const QObject sender,
int  signal_index,
const QObject receiver,
int  membcode,
int  member_index 
) [static]
void QObject::connectInternal ( const QObject sender,
int  signal_index,
const QObject receiver,
int  membcode,
int  member_index 
) [static]
void QObject::connectNotify ( const char *  signal) [protected, virtual]

This virtual function is called when something has been connected to signal in this object.

Atención:
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.
Ver también:
connect(), disconnectNotify()

Reimplementado en QClipboard, QProcess, QClipboard y QProcess.

virtual void QObject::connectNotify ( const char *  signal) [protected, virtual]

Reimplementado en QClipboard, QProcess, QClipboard y QProcess.

void QObject::customEvent ( QCustomEvent ) [protected, virtual]

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 QEvent::Type enum, and is typically a QCustomEvent or QCustomEvent subclass.

Ver también:
event(), QCustomEvent
virtual void QObject::customEvent ( QCustomEvent ) [protected, virtual]
void QObject::deleteLater ( ) [slot]

Performs a deferred deletion of this object.

Instead of an immediate deletion this function schedules a deferred delete event for processing when Qt returns to the main event loop.

void QObject::deleteLater ( ) [slot]
QObject::destroyed ( ) [signal]

This signal is emitted when the object is being destroyed.

Note that the signal is emitted by the QObject 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.

All the objects's children are destroyed immediately after this signal is emitted.

QObject::destroyed ( QObject obj) [signal]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.

This signal is emitted immediately before the object obj is destroyed, and can not be blocked.

All the objects's children are destroyed immediately after this signal is emitted.

void QObject::destroyed ( ) [signal]
void QObject::destroyed ( QObject obj) [signal]
static bool QObject::disconnect ( const QObject sender,
const char *  signal,
const QObject receiver,
const char *  member 
) [static]
bool QObject::disconnect ( const char *  signal = 0,
const QObject receiver = 0,
const char *  member = 0 
)
bool QObject::disconnect ( const QObject receiver,
const char *  member = 0 
)

Reimplementado en QSignal y QSignal.

bool QObject::disconnect ( const QObject sender,
const char *  signal,
const QObject receiver,
const char *  member 
) [static]

Disconnects signal in object sender from member in object receiver.

A signal-slot connection is removed when either of the objects involved are destroyed.

disconnect() is typically used in three ways, as the following examples demonstrate. 1 Disconnect everything connected to an object's signals:

       disconnect( myObject, 0, 0, 0 );

equivalent to the non-static overloaded function

       myObject->disconnect();

Disconnect everything connected to a specific signal:

       disconnect( myObject, SIGNAL(mySignal()), 0, 0 );

equivalent to the non-static overloaded function

       myObject->disconnect( SIGNAL(mySignal()) );

Disconnect a specific receiver:

       disconnect( myObject, 0, myReceiver, 0 );

equivalent to the non-static overloaded function

       myObject->disconnect(  myReceiver );

0 may be used as a wildcard, meaning "any signal", "any receiving object", or "any slot in the receiving object", respectively.

The sender may never be 0. (You cannot disconnect signals from more than one object in a single call.)

If signal is 0, it disconnects receiver and member from any signal. If not, only the specified signal is disconnected.

If receiver is 0, it disconnects anything connected to signal. If not, slots in objects other than receiver are not disconnected.

If member is 0, it disconnects anything that is connected to receiver. If not, only slots named member will be disconnected, and all other slots are left alone. The member must be 0 if receiver is left out, so you cannot disconnect a specifically-named slot on all objects.

Ver también:
connect()
bool QObject::disconnect ( const char *  signal = 0,
const QObject receiver = 0,
const char *  member = 0 
) [inline]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.

Disconnects signal from member of receiver.

A signal-slot connection is removed when either of the objects involved are destroyed.

bool QObject::disconnect ( const QObject receiver,
const char *  member = 0 
) [inline]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.

Disconnects all signals in this object from receiver's member.

A signal-slot connection is removed when either of the objects involved are destroyed.

Reimplementado en QSignal y QSignal.

static bool QObject::disconnectInternal ( const QObject sender,
int  signal_index,
const QObject receiver,
int  membcode,
int  member_index 
) [static]
bool QObject::disconnectInternal ( const QObject sender,
int  signal_index,
const QObject receiver,
int  membcode,
int  member_index 
) [static]
virtual void QObject::disconnectNotify ( const char *  signal) [protected, virtual]

Reimplementado en QProcess y QProcess.

void QObject::disconnectNotify ( const char *  signal) [protected, virtual]

This virtual function is called when something has been disconnected from signal in this object.

Atención:
This function violates the object-oriented principle of modularity. However, it might be useful for optimizing access to expensive resources.
Ver también:
disconnect(), connectNotify()

Reimplementado en QProcess y QProcess.

void QObject::dumpObjectInfo ( )
void QObject::dumpObjectInfo ( )

Dumps information about signal connections, etc. for this object to the debug output.

This function is useful for debugging, but does nothing if the library has been compiled in release mode (i.e. without debugging information).

void QObject::dumpObjectTree ( )
void QObject::dumpObjectTree ( )

Dumps a tree of children to the debug output.

This function is useful for debugging, but does nothing if the library has been compiled in release mode (i.e. without debugging information).

bool QObject::event ( QEvent e) [virtual]
virtual bool QObject::event ( QEvent ) [virtual]
bool QObject::eventFilter ( QObject ,
QEvent  
) [virtual]

Filters events if this object has been installed as an event filter for the watched object.

In your reimplementation of this function, if you want to filter the event e, out, i.e. stop it being handled further, return TRUE; otherwise return FALSE.

Example:

    class MyMainWindow : public QMainWindow
    {
    public:
        MyMainWindow( QWidget *parent = 0, const char *name = 0 );

    protected:
        bool eventFilter( QObject *obj, QEvent *ev );

    private:
        QTextEdit *textEdit;
    };

    MyMainWindow::MyMainWindow( QWidget *parent, const char *name )
        : QMainWindow( parent, name )
    {
        textEdit = new QTextEdit( this );
        setCentralWidget( textEdit );
        textEdit->installEventFilter( this );
    }

    bool MyMainWindow::eventFilter( QObject *obj, QEvent *ev )
    {
        if ( obj == textEdit ) {
            if ( e->type() == QEvent::KeyPress ) {
                QKeyEvent *k = (QKeyEvent*)ev;
                qDebug( "Ate key press %d", k->key() );
                return TRUE;
            } else {
                return FALSE;
            }
        } else {
            // pass the event on to the parent class
            return QMainWindow::eventFilter( obj, ev );
        }
    }

Notice in the example above that unhandled events are passed to the base class's eventFilter() function, since the base class might have reimplemented eventFilter() for its own internal purposes.

Atención:
If you delete the receiver object in this function, be sure to return TRUE. Otherwise, Qt will forward the event to the deleted object and the program might crash.
Ver también:
installEventFilter()

Reimplementado en AQSObject, FLDataTable, BluecurveStyle, QtCKStyle, ShortcutHandler, QSAEditorBrowser, QSAEditorInterface, QSEditor, EditorBrowser, EditorCompletion, Editor, QAquaFocusWidget, QAquaAnimate, QWidgetResizeHandler, QAccel, QComboBox, QDataTable, QDialog, QDockArea, QDockWindow, QFileDialog, QIconView, QLayout, QListBox, QListView, QMainWindow, QMenuBar, QMotifPlusStyle, QScrollView, QSGIStyle, QSizeGrip, QSpinBox, QTable, QTabWidget, QTextEdit, QToolButton, QWizard, QWorkspace, QDialog, QFileDialog, QWizard, QIconView, QAccel, QLayout, QSizeGrip, QDataTable, QAquaFocusWidget, QAquaAnimate, QMotifPlusStyle, QSGIStyle, QWindowsStyle::Private, QTable, QComboBox, QDateTimeEditor, QDockArea, QDockWindow, QAlphaWidget, QRollEffect, QListBox, QListView, QHideDock, QMainWindow, QMenuBar, QScrollView, QSpinBox, QTabWidget, QTextEdit, QToolButton, QTipManager, QWhatsThisPrivate, QWidgetResizeHandler, QWidgetStackEventFilter, QWorkspaceChild, QWorkspace, QDesignerToolBar, ListBoxRename, ListDnd, MainWindow, MenuBarEditor, PopupMenuEditorItem, PopupMenuEditor, QCompletionEdit, QDesignerTabWidget, Workspace, EditorBrowser, EditorCompletion, Editor, EditorInterfaceImpl, MessageEditor, QwtLegend, QwtMagnifier, QwtPanner, QwtPicker y QwtGuardedPainter.

virtual bool QObject::eventFilter ( QObject ,
QEvent  
) [virtual]
bool QObject::highPriority ( ) const [inline]
bool QObject::highPriority ( ) const [inline]

Returns TRUE if the object is a high-priority object, or FALSE if it is a standard-priority object.

High-priority objects are placed first in QObject's list of children on the assumption that they will be referenced very often.

bool QObject::inherits ( const char *  clname) const

Returns TRUE if this object is an instance of a class that inherits clname, and clname inherits QObject; otherwise returns FALSE.

A class is considered to inherit itself.

Example:

        QTimer *t = new QTimer;         // QTimer inherits QObject
        t->inherits( "QTimer" );        // returns TRUE
        t->inherits( "QObject" );       // returns TRUE
        t->inherits( "QButton" );       // returns FALSE

        // QScrollBar inherits QWidget and QRangeControl
        QScrollBar *s = new QScrollBar( 0 );
        s->inherits( "QWidget" );       // returns TRUE
        s->inherits( "QRangeControl" ); // returns FALSE

( QRangeControl is not a QObject.)

Ver también:
isA(), metaObject()
bool QObject::inherits ( const char *  ) const
void QObject::insertChild ( QObject obj) [virtual]

Inserts an object obj into the list of child objects.

Atención:
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 QWidget::reparent().
Ver también:
removeChild(), QWidget::reparent()

Reimplementado en AQSObject, QTextDocument, QDesktopWidget, QDesktopWidget y QTextDocument.

virtual void QObject::insertChild ( QObject ) [virtual]
void QObject::installEventFilter ( const QObject )
void QObject::installEventFilter ( const QObject filterObj)

Installs an event filter filterObj on this object. For example:

    monitoredObj->installEventFilter( filterObj );

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 filterObj receives events via its eventFilter() function. The eventFilter() function must return TRUE if the event should be filtered, (i.e. stopped); otherwise it must return FALSE.

If multiple event filters are installed on a single object, the filter that was installed last is activated first.

Here's a KeyPressEater class that eats the key presses of its monitored objects:

    class KeyPressEater : public QObject
    {
        ...
    protected:
        bool eventFilter( QObject *o, QEvent *e );
    };

    bool KeyPressEater::eventFilter( QObject *o, QEvent *e )
    {
        if ( e->type() == QEvent::KeyPress ) {
            // special processing for key press
            QKeyEvent *k = (QKeyEvent *)e;
            qDebug( "Ate key press %d", k->key() );
            return TRUE; // eat event
        } else {
            // standard event processing
            return FALSE;
        }
    }

And here's how to install it on two widgets:

        KeyPressEater *keyPressEater = new KeyPressEater( this );
        QPushButton *pushButton = new QPushButton( this );
        QListView *listView = new QListView( this );

        pushButton->installEventFilter( keyPressEater );
        listView->installEventFilter( keyPressEater );

The QAccel class, for example, uses this technique to intercept accelerator key presses.

Atención:
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.
Ver también:
removeEventFilter(), eventFilter(), event()
bool QObject::isA ( const char *  clname) const

Returns TRUE if this object is an instance of the class clname; otherwise returns FALSE.

Example:

    QTimer *t = new QTimer; // QTimer inherits QObject
    t->isA( "QTimer" );     // returns TRUE
    t->isA( "QObject" );    // returns FALSE
Ver también:
inherits() metaObject()
bool QObject::isA ( const char *  ) const
bool QObject::isWidgetType ( ) const [inline]

Returns TRUE if the object is a widget; otherwise returns FALSE.

Calling this function is equivalent to calling inherits("QWidget"), except that it is much faster.

Reimplementado en AQSObject.

bool QObject::isWidgetType ( ) const [inline]

Reimplementado en AQSObject.

void QObject::killTimer ( int  id)
void QObject::killTimer ( int  id)

Kills the timer with timer identifier, id.

The timer identifier is returned by startTimer() when a timer event is started.

Ver también:
timerEvent(), startTimer(), killTimers()
void QObject::killTimers ( )
void QObject::killTimers ( )

Kills all timers that this object has started.

Atención:
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 QTimer or perhaps killTimer().
Ver también:
timerEvent(), startTimer(), killTimer()
const char* QObject::name ( const char *  defaultName) const
const char* QObject::name ( ) const
const char* QObject::name ( ) const
const char * QObject::name ( const char *  defaultName) const

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Returns the name of this object, or defaultName if the object does not have a name.

static QCString QObject::normalizeSignalSlot ( const char *  signalSlot) [static, protected]
QCString QObject::normalizeSignalSlot ( const char *  signalSlot) [static, protected]

Normlizes the signal or slot definition signalSlot by removing unnecessary whitespace.

Reimplementado en NormalizeObject, NormalizeObject, NormalizeObject y NormalizeObject.

const QObjectList * QObject::objectTrees ( ) [static]

Returns a pointer to the list of all object trees (their root objects), or 0 if there are no objects.

The QObjectList class is defined in the qobjectlist.h header file.

The most recent root object created is the first object in the list and the first root object added is the last object in the list.

Ver también:
children(), parent(), insertChild(), removeChild()
static const QObjectList* QObject::objectTrees ( ) [static]
QObject * QObject::parent ( ) const [inline]

Returns a pointer to the parent object.

Ver también:
children()

Reimplementado en AQSListViewItem, AQSObject, FLListViewItemInterface, QTextDocument y QTextDocument.

QObject* QObject::parent ( ) const [inline]
QVariant QObject::property ( const char *  name) const [virtual]

Returns the value of the object's name property.

If no such property exists, the returned variant is invalid.

Information about all available properties are provided through the metaObject().

Ver también:
setProperty(), QVariant::isValid(), metaObject(), QMetaObject::propertyNames(), QMetaObject::property()

Reimplementado en PropertyObject.

virtual QVariant QObject::property ( const char *  name) const [virtual]

Reimplementado en PropertyObject.

QObjectList * QObject::queryList ( const char *  inheritsClass = 0,
const char *  objName = 0,
bool  regexpMatch = TRUE,
bool  recursiveSearch = TRUE 
) const

Searches the children and optionally grandchildren of this object, and returns a list of those objects that are named or that match objName and inherit inheritsClass. If inheritsClass is 0 (the default), all classes match. If objName is 0 (the default), all object names match.

If regexpMatch is TRUE (the default), objName is a regular expression that the objects's names must match. The syntax is that of a QRegExp. If regexpMatch is FALSE, objName is a string and object names must match it exactly.

Note that inheritsClass uses single inheritance from QObject, the way inherits() does. According to inherits(), QMenuBar inherits QWidget but not QMenuData. This does not quite match reality, but is the best that can be done on the wide variety of compilers Qt supports.

Finally, if recursiveSearch is TRUE (the default), queryList() searches {n}th-generation as well as first-generation children.

If all this seems a bit complex for your needs, the simpler child() function may be what you want.

This somewhat contrived example disables all the buttons in this window:

    QObjectList *l = topLevelWidget()->queryList( "QButton" );
    QObjectListIt it( *l ); // iterate over the buttons
    QObject *obj;

    while ( (obj = it.current()) != 0 ) {
        // for each found object...
        ++it;
        ((QButton*)obj)->setEnabled( FALSE );
    }
    delete l; // delete the list, not the objects

The QObjectList class is defined in the qobjectlist.h header file.

Atención:
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).
Ver también:
child() children(), parent(), inherits(), name(), QRegExp
QObjectList* QObject::queryList ( const char *  inheritsClass = 0,
const char *  objName = 0,
bool  regexpMatch = TRUE,
bool  recursiveSearch = TRUE 
) const
QConnectionList * QObject::receivers ( int  signal) const [protected]
QConnectionList* QObject::receivers ( int  signal) const [protected]
QConnectionList * QObject::receivers ( const char *  signal) const [protected]
QConnectionList* QObject::receivers ( const char *  signal) const [protected]
static uint QObject::registerUserData ( ) [static]
uint QObject::registerUserData ( ) [static]
virtual void QObject::removeChild ( QObject ) [virtual]
void QObject::removeChild ( QObject obj) [virtual]

Removes the child object obj from the list of children.

Atención:
This function will not remove a child widget from the screen. It will only remove it from the parent widget's list of children.
Ver también:
insertChild(), QWidget::reparent()

Reimplementado en AQSObject, QTextDocument, QScrollView, QTextDocument y QScrollView.

void QObject::removeEventFilter ( const QObject )
void QObject::removeEventFilter ( const QObject obj)

Removes an event filter object obj from this object. The request is ignored if such an event filter has not been installed.

All event filters for this object are automatically removed when this object is destroyed.

It is always safe to remove an event filter, even during event filter activation (i.e. from the eventFilter() function).

Ver también:
installEventFilter(), eventFilter(), event()
const QObject * QObject::sender ( ) [protected]

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.

The pointer returned by this function becomes invalid if the sender is destroyed, or if the slot is disconnected from the sender's signal.

Atención:
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.
const QObject* QObject::sender ( ) [protected]
virtual void QObject::setName ( const char *  name) [virtual]

Reimplementado en QWidget y QWidget.

void QObject::setName ( const char *  name) [virtual]

Sets the object's name to name.

Reimplementado en QWidget y QWidget.

virtual bool QObject::setProperty ( const char *  name,
const QVariant value 
) [virtual]

Reimplementado en PropertyObject.

bool QObject::setProperty ( const char *  name,
const QVariant value 
) [virtual]

Sets the value of the object's name property to value.

Returns TRUE if the operation was successful; otherwise returns FALSE.

Information about all available properties is provided through the metaObject().

Ver también:
property(), metaObject(), QMetaObject::propertyNames(), QMetaObject::property()

Reimplementado en PropertyObject.

void QObject::setUserData ( uint  id,
QObjectUserData data 
)
void QObject::setUserData ( uint  id,
QObjectUserData data 
)
bool QObject::signalsBlocked ( ) const [inline]

Returns TRUE if signals are blocked; otherwise returns FALSE.

Signals are not blocked by default.

Ver también:
blockSignals()
bool QObject::signalsBlocked ( ) const [inline]
int QObject::startTimer ( int  interval)

Starts a timer and returns a timer identifier, or returns zero if it could not start a timer.

A timer event will occur every interval milliseconds until killTimer() or killTimers() is called. If interval is 0, then the timer event occurs once every time there are no more window system events to process.

The virtual timerEvent() function is called with the QTimerEvent event parameter class when a timer event occurs. Reimplement this function to get timer events.

If multiple timers are running, the QTimerEvent::timerId() can be used to find out which timer was activated.

Example:

    class MyObject : public QObject
    {
        Q_OBJECT
    public:
        MyObject( QObject *parent = 0, const char *name = 0 );

    protected:
        void timerEvent( QTimerEvent * );
    };

    MyObject::MyObject( QObject *parent, const char *name )
        : QObject( parent, name )
    {
        startTimer( 50 );    // 50-millisecond timer
        startTimer( 1000 );  // 1-second timer
        startTimer( 60000 ); // 1-minute timer
    }

    void MyObject::timerEvent( QTimerEvent *e )
    {
        qDebug( "timer event, id %d", e->timerId() );
    }

Note that QTimer's accuracy depends on the underlying operating system and hardware. Most platforms support an accuracy of 20 ms; some provide more. If Qt is unable to deliver the requested number of timer clicks, it will silently discard some.

The QTimer class provides a high-level programming interface with one-shot timers and timer signals instead of events.

Ver también:
timerEvent(), killTimer(), killTimers(), QEventLoop::awake(), QEventLoop::aboutToBlock()
int QObject::startTimer ( int  interval)
void QObject::timerEvent ( QTimerEvent ) [protected, virtual]

This event handler can be reimplemented in a subclass to receive timer events for the object.

QTimer provides a higher-level interface to the timer functionality, and also more general information about timers.

Ver también:
startTimer(), killTimer(), killTimers(), event()

Reimplementado en TimerObject, QAquaAnimate, QDateEdit, QTimeEdit, QHttp, QPopupMenu, QtMultiLineEdit, QMacAnimateCursor, QPMCache, QHttp, QAquaAnimate, QDateEdit, QTimeEdit, QPopupMenu y QwtAbstractSlider.

virtual void QObject::timerEvent ( QTimerEvent ) [protected, virtual]
QObjectUserData * QObject::userData ( uint  id) const
QObjectUserData* QObject::userData ( uint  id) const

Documentación de las funciones relacionadas y clases amigas

QApplication [friend]
QBaseApplication [friend]

Reimplementado en QClipboard, QSessionManager y QWidget.

QSignal [friend]
void * qt_find_obj_child ( QObject parent,
const char *  type,
const char *  name 
) [related]

Returns a pointer to the object named name that inherits type and with a given parent.

Returns 0 if there is no such child.

        QListBox *c = (QListBox *) qt_find_obj_child( myWidget, "QListBox",
                                                      "my list box" );
        if ( c )
            c->insertItem( "another string" );
QWidget [friend]

Reimplementado en QApplication.


Documentación de propiedades

QCString QObject::name [read, write]

the name of this object

You can find an object by name (and type) using child(). You can find a set of objects with queryList().

The object name is set by the constructor or by the setName() function. The object name is not very useful in the current version of Qt, but will become increasingly important in the future.

If the object does not have a name, the name() function returns "unnamed", so printf() (used in qDebug()) 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 ).

        qDebug( "MyClass::setPrecision(): (%s) invalid precision %f",
                name(), newPrecision );
Ver también:
className(), child(), queryList()

Reimplementado en opInfo.


La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'