QObjectCleanupHandler(3qt)
π QObjectCleanupHandler β the 3qt manual page, bestie edition π
okay so bestie, sit down, hydrate, because we're about to talk about QObjectCleanupHandler β yes, that's the 3qt one, and yes it's giving quietly iconic β¨
πΈ NAME πΈ
QObjectCleanupHandler β the little class that Watches the lifetime of multiple QObjects ππ«Ά
β¨ SYNOPSIS β¨
#include <qobjectcleanuphandler.h>
It Inherits QObject. Periodt. π
π Public Members π
QObjectCleanupHandler ()~QObjectCleanupHandler ()QObject * add ( QObject * object )void remove ( QObject * object )bool isEmpty () constvoid clear ()
π¦ DESCRIPTION π¦
The QObjectCleanupHandler class watches the lifetime of multiple QObjects. no cap, that's literally the whole job and she does it flawlessly π
A QObjectCleanupHandler is useful whenever you need to know when a number of QObjects that are owned by someone else have been deleted. lowkey this matters a LOT β for example, when referencing memory in an application that has been allocated in a shared library. you don't own those objects, but you do need the tea on when they ghost you π
Example, bestie, look at the code, it's so good:
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();
}
See also Object Model. π«Ά
π MEMBER FUNCTION DOCUMENTATION π
π QObjectCleanupHandler::QObjectCleanupHandler ()
Constructs an empty QObjectCleanupHandler. brand new, zero objects, fresh start energy π±β¨
π QObjectCleanupHandler::~QObjectCleanupHandler ()
Destroys the cleanup handler. All objects in this cleanup handler will be deleted. she takes everyone with her, it's giving dramatic exit ππͺοΈ
π QObject * QObjectCleanupHandler::add ( QObject * object )
Adds object to this cleanup handler and returns the pointer to the object. you hand her the object, she hands it right back β mutual, respectful, slay π«Ά
π QObjectCleanupHandler::clear ()
Deletes all objects in this cleanup handler. The cleanup handler becomes empty. like a full reset, no crumbs left π
π QObjectCleanupHandler::isEmpty () const
Returns TRUE if this cleanup handler is empty or if all objects in this cleanup handler have been destroyed; otherwise return FALSE. vibe check: is she empty? is everyone gone? TRUE. otherwise FALSE. fr fr π
π QObjectCleanupHandler::remove ( QObject * object )
Removes the object from this cleanup handler. The object will not be destroyed. she lets them go, respectfully, alive and well ππ
π₯ SEE ALSO π₯
π COPYRIGHT π
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.
π§ AUTHOR π§
Generated automatically from the source code. (yes, she's a bot-written girlie and she's still eating π β¨)
π BUGS π
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. π«Ά
The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.
If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qobjectcleanuphandler.3qt) and the Qt version (3.3.8). β
bestie, lowkey the most important rule of this whole page: she watches objects she does not own. so when she says "all objects in this cleanup handler will be deleted," believe her. ππ
that's the whole page, mwah π β brought to you by Trolltech AS, dated 2 February 2007, Qt version 3.3.8, and yes the manual name is QObjectCleanupHandler(3qt). ily, go write some clean code πΈπ¦π
π¦ where this page comes from
- fedora 43: qt3-devel-docs 3.3.8b-102.fc43 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- fedora 44: qt3-devel-docs 3.3.8b-103.fc44 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms