forked from quickshell/quickshell
core/reloader: fix Quickshell.reload not working
Has been broken since engine generations were introduced.
This commit is contained in:
parent
4eb5dc5593
commit
c6bf826031
|
@ -12,6 +12,8 @@
|
||||||
#include "shell.hpp"
|
#include "shell.hpp"
|
||||||
#include "singleton.hpp"
|
#include "singleton.hpp"
|
||||||
|
|
||||||
|
class RootWrapper;
|
||||||
|
|
||||||
class EngineGeneration: public QObject {
|
class EngineGeneration: public QObject {
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
|
|
||||||
|
@ -28,6 +30,7 @@ public:
|
||||||
|
|
||||||
static EngineGeneration* findObjectGeneration(QObject* object);
|
static EngineGeneration* findObjectGeneration(QObject* object);
|
||||||
|
|
||||||
|
RootWrapper* wrapper = nullptr;
|
||||||
QmlScanner scanner;
|
QmlScanner scanner;
|
||||||
QsUrlInterceptor urlInterceptor;
|
QsUrlInterceptor urlInterceptor;
|
||||||
QsInterceptNetworkAccessManagerFactory interceptNetFactory;
|
QsInterceptNetworkAccessManagerFactory interceptNetFactory;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <qvariant.h>
|
#include <qvariant.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "generation.hpp"
|
||||||
#include "qmlscreen.hpp"
|
#include "qmlscreen.hpp"
|
||||||
#include "rootwrapper.hpp"
|
#include "rootwrapper.hpp"
|
||||||
|
|
||||||
|
@ -144,8 +145,8 @@ QQmlListProperty<QuickshellScreenInfo> QuickshellGlobal::screens() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickshellGlobal::reload(bool hard) {
|
void QuickshellGlobal::reload(bool hard) {
|
||||||
auto* rootobj = QQmlEngine::contextForObject(this)->engine()->parent();
|
auto* generation = EngineGeneration::findObjectGeneration(this);
|
||||||
auto* root = qobject_cast<RootWrapper*>(rootobj);
|
auto* root = generation == nullptr ? nullptr : generation->wrapper;
|
||||||
|
|
||||||
if (root == nullptr) {
|
if (root == nullptr) {
|
||||||
qWarning() << "cannot find RootWrapper for reload, ignoring request";
|
qWarning() << "cannot find RootWrapper for reload, ignoring request";
|
||||||
|
|
|
@ -46,6 +46,7 @@ void RootWrapper::reloadGraph(bool hard) {
|
||||||
scanner.scanQmlFile(this->rootPath);
|
scanner.scanQmlFile(this->rootPath);
|
||||||
|
|
||||||
auto* generation = new EngineGeneration(std::move(scanner));
|
auto* generation = new EngineGeneration(std::move(scanner));
|
||||||
|
generation->wrapper = this;
|
||||||
|
|
||||||
// todo: move into EngineGeneration
|
// todo: move into EngineGeneration
|
||||||
if (this->generation != nullptr) {
|
if (this->generation != nullptr) {
|
||||||
|
|
Loading…
Reference in a new issue