2024-01-25 12:33:02 +00:00
|
|
|
#pragma once
|
|
|
|
|
2024-02-01 02:35:51 +00:00
|
|
|
#include <qcontainerfwd.h>
|
2024-02-01 09:29:45 +00:00
|
|
|
#include <qlist.h>
|
2024-01-25 12:33:02 +00:00
|
|
|
#include <qlogging.h>
|
|
|
|
#include <qobject.h>
|
|
|
|
#include <qqmlengine.h>
|
|
|
|
#include <qqmllist.h>
|
2024-02-01 02:35:51 +00:00
|
|
|
#include <qtmetamacros.h>
|
2024-01-25 12:33:02 +00:00
|
|
|
|
2024-02-01 09:29:45 +00:00
|
|
|
#include "scavenge.hpp"
|
|
|
|
|
|
|
|
class QtShell: public Scavenger, virtual public Scavengeable {
|
2024-01-25 12:33:02 +00:00
|
|
|
Q_OBJECT;
|
2024-02-01 02:35:51 +00:00
|
|
|
Q_PROPERTY(QQmlListProperty<QObject> components READ components FINAL);
|
2024-01-25 12:33:02 +00:00
|
|
|
Q_CLASSINFO("DefaultProperty", "components");
|
|
|
|
QML_ELEMENT;
|
|
|
|
|
|
|
|
public:
|
2024-02-01 09:29:45 +00:00
|
|
|
explicit QtShell(QObject* parent = nullptr): Scavenger(parent) {}
|
|
|
|
|
|
|
|
void earlyInit(QObject* old) override;
|
|
|
|
QObject* scavengeTargetFor(QObject* child) override;
|
2024-01-25 12:33:02 +00:00
|
|
|
|
2024-02-01 02:35:51 +00:00
|
|
|
QQmlListProperty<QObject> components();
|
2024-01-25 12:33:02 +00:00
|
|
|
|
2024-02-01 01:43:18 +00:00
|
|
|
public slots:
|
2024-02-01 09:29:45 +00:00
|
|
|
void reload(bool hard = true);
|
2024-02-01 01:43:18 +00:00
|
|
|
|
2024-01-25 12:33:02 +00:00
|
|
|
private:
|
2024-02-01 02:35:51 +00:00
|
|
|
static void appendComponent(QQmlListProperty<QObject>* list, QObject* component);
|
2024-02-01 09:29:45 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
// track only the children assigned to `components` in order
|
|
|
|
QList<QObject*> children;
|
|
|
|
QList<QObject*> scavengeableChildren;
|
2024-01-25 12:33:02 +00:00
|
|
|
};
|