feat: add hard reload signal and wrap root object

This commit is contained in:
outfoxxed 2024-01-31 17:43:18 -08:00
parent d14258df8e
commit 9a5ad44aa9
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
6 changed files with 116 additions and 22 deletions

28
src/cpp/rootwrapper.hpp Normal file
View file

@ -0,0 +1,28 @@
#pragma once
#include <qobject.h>
#include <qobjectdefs.h>
#include <qqmlengine.h>
#include <qtmetamacros.h>
#include <qurl.h>
#include "shell.hpp"
class RootWrapper: public QObject {
Q_OBJECT;
public:
explicit RootWrapper(QUrl rootUrl);
void reloadGraph();
void changeRoot(QtShell* newRoot);
private slots:
void destroy();
private:
QUrl rootUrl;
QQmlEngine engine;
QtShell* activeRoot = nullptr;
QMetaObject::Connection destroyConnection;
};