| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QOBJECTCLEANUPHANDLER_H |
| 5 | #define QOBJECTCLEANUPHANDLER_H |
| 6 | |
| 7 | #include <QtCore/qobject.h> |
| 8 | |
| 9 | QT_BEGIN_NAMESPACE |
| 10 | |
| 11 | class Q_CORE_EXPORT QObjectCleanupHandler : public QObject |
| 12 | { |
| 13 | Q_OBJECT |
| 14 | |
| 15 | public: |
| 16 | QObjectCleanupHandler(); |
| 17 | ~QObjectCleanupHandler(); |
| 18 | |
| 19 | QObject *add(QObject *object); |
| 20 | void remove(QObject *object); |
| 21 | bool isEmpty() const; |
| 22 | void clear(); |
| 23 | |
| 24 | private: |
| 25 | // ### move into d pointer |
| 26 | QObjectList cleanupObjects; |
| 27 | |
| 28 | private Q_SLOTS: |
| 29 | void objectDestroyed(QObject *); |
| 30 | }; |
| 31 | |
| 32 | QT_END_NAMESPACE |
| 33 | |
| 34 | #endif // QOBJECTCLEANUPHANDLER_H |
| 35 | |