forked from quickshell/quickshell
feat: implement soft reloading
This commit is contained in:
parent
ba1e18a125
commit
362789fc46
11 changed files with 385 additions and 21 deletions
|
@ -1,26 +1,37 @@
|
|||
#pragma once
|
||||
|
||||
#include <qcontainerfwd.h>
|
||||
#include <qlist.h>
|
||||
#include <qlogging.h>
|
||||
#include <qobject.h>
|
||||
#include <qqmlengine.h>
|
||||
#include <qqmllist.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class QtShell: public QObject {
|
||||
#include "scavenge.hpp"
|
||||
|
||||
class QtShell: public Scavenger, virtual public Scavengeable {
|
||||
Q_OBJECT;
|
||||
Q_PROPERTY(QQmlListProperty<QObject> components READ components FINAL);
|
||||
Q_CLASSINFO("DefaultProperty", "components");
|
||||
QML_ELEMENT;
|
||||
|
||||
public:
|
||||
explicit QtShell(QObject* parent = nullptr): QObject(parent) {}
|
||||
explicit QtShell(QObject* parent = nullptr): Scavenger(parent) {}
|
||||
|
||||
void earlyInit(QObject* old) override;
|
||||
QObject* scavengeTargetFor(QObject* child) override;
|
||||
|
||||
QQmlListProperty<QObject> components();
|
||||
|
||||
public slots:
|
||||
void reload();
|
||||
void reload(bool hard = true);
|
||||
|
||||
private:
|
||||
static void appendComponent(QQmlListProperty<QObject>* list, QObject* component);
|
||||
|
||||
public:
|
||||
// track only the children assigned to `components` in order
|
||||
QList<QObject*> children;
|
||||
QList<QObject*> scavengeableChildren;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue