9QxObjectPool::QxObjectPool(QObject *parent)
20 if (m_objects.contains(QPointer<QObject>(
object)))
23 m_objects.append(
object);
32 const int index = m_objects.indexOf(QPointer<QObject>(
object));
37 m_objects.removeAt(index);
44 QList<QObject *> live;
45 live.reserve(m_objects.count());
46 for (
const QPointer<QObject> &entry : m_objects) {
48 live.append(entry.data());
58 const QList<QObject *> live =
objects();
59 for (QObject *
object : live) {
void aboutToRemoveObject(QObject *object)
Emitted just before removeObject() takes object out.
T * object() const
The first live published object castable to T, or null.
QList< QObject * > objects() const
Everything published and still alive, in the order it was published.
void objectAdded(QObject *object)
Emitted after object joined the pool.
void removeObject(QObject *object)
Takes object out.
QObject * objectByName(const QString &name) const
The first live published object whose objectName() is name, or null.
void addObject(QObject *object)
Publishes object under its objectName().
#define Q_NULLPTR
Copyleft (C) 2025 maminjie canpool@163.com SPDX-License-Identifier: MulanPSL-2.0
#define QX_PLUGIN_BEGIN_NAMESPACE
#define QX_PLUGIN_END_NAMESPACE