Eneboo - Documentación para desarrolladores
Métodos públicos
Referencia de la Clase QObjectCleanupHandler

The QObjectCleanupHandler class watches the lifetime of multiple QObjects. Más...

#include <qobjectcleanuphandler.h>

Diagrama de herencias de QObjectCleanupHandler
QObject QObject Qt Qt Qt Qt

Lista de todos los miembros.

Métodos públicos

 QObjectCleanupHandler ()
 ~QObjectCleanupHandler ()
QObjectadd (QObject *object)
void remove (QObject *object)
bool isEmpty () const
void clear ()
 QObjectCleanupHandler ()
 ~QObjectCleanupHandler ()
QObjectadd (QObject *object)
void remove (QObject *object)
bool isEmpty () const
void clear ()

Descripción detallada

The QObjectCleanupHandler class watches the lifetime of multiple QObjects.

A QObjectCleanupHandler is useful whenever you need to know when a number of {QObject}s that are owned by someone else have been deleted. This is important, for example, when referencing memory in an application that has been allocated in a shared library.

Example:

    class FactoryComponent : public FactoryInterface, public QLibraryInterface
    {
    public:
        ...

        QObject *createObject();

        bool init();
        void cleanup();
        bool canUnload() const;

    private:
        QObjectCleanupHandler objects;
    };

    // allocate a new object, and add it to the cleanup handler
    QObject *FactoryComponent::createObject()
    {
        return objects.add( new QObject() );
    }

    // QLibraryInterface implementation
    bool FactoryComponent::init()
    {
        return TRUE;
    }

    void FactoryComponent::cleanup()
    {
    }

    // it is only safe to unload the library when all QObject's have been destroyed
    bool FactoryComponent::canUnload() const
    {
        return objects.isEmpty();
    }

Documentación del constructor y destructor

QObjectCleanupHandler::QObjectCleanupHandler ( )

Constructs an empty QObjectCleanupHandler.

QObjectCleanupHandler::~QObjectCleanupHandler ( )

Destroys the cleanup handler. All objects in this cleanup handler will be deleted.

QObjectCleanupHandler::QObjectCleanupHandler ( )
QObjectCleanupHandler::~QObjectCleanupHandler ( )

Documentación de las funciones miembro

QObject * QObjectCleanupHandler::add ( QObject object)

Adds object to this cleanup handler and returns the pointer to the object.

QObject* QObjectCleanupHandler::add ( QObject object)
void QObjectCleanupHandler::clear ( )
void QObjectCleanupHandler::clear ( void  )

Deletes all objects in this cleanup handler. The cleanup handler becomes empty.

bool QObjectCleanupHandler::isEmpty ( ) const
bool QObjectCleanupHandler::isEmpty ( void  ) const

Returns TRUE if this cleanup handler is empty or if all objects in this cleanup handler have been destroyed; otherwise return FALSE.

void QObjectCleanupHandler::remove ( QObject object)

Removes the object from this cleanup handler. The object will not be destroyed.

void QObjectCleanupHandler::remove ( QObject object)

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'