mirror of
https://github.com/quickshell-mirror/quickshell.git
synced 2026-10-27 02:54:36 +00:00
core/reloader: delay post-reload reload hooks
Ensures onReload runs after Component.onCompleted.
This commit is contained in:
1 file changed
+5
-2
+5
-2
@@ -3,6 +3,7 @@
|
||||
#include <qcontainerfwd.h>
|
||||
#include <qobject.h>
|
||||
#include <qqmllist.h>
|
||||
#include <qtimer.h>
|
||||
|
||||
#include "generation.hpp"
|
||||
|
||||
@@ -12,8 +13,10 @@ void Reloadable::componentComplete() {
|
||||
if (this->engineGeneration != nullptr) {
|
||||
// When called this way there is no chance a reload will have old data,
|
||||
// but this will at least help prevent weird behaviors due to never getting a reload.
|
||||
if (this->engineGeneration->reloadComplete) this->reload();
|
||||
else {
|
||||
if (this->engineGeneration->reloadComplete) {
|
||||
// Delayed due to Component.onCompleted running after QQmlParserStatus::componentComplete.
|
||||
QTimer::singleShot(0, this, &Reloadable::onReloadFinished);
|
||||
} else {
|
||||
QObject::connect(
|
||||
this->engineGeneration,
|
||||
&EngineGeneration::reloadFinished,
|
||||
|
||||
Reference in new issue
Block a user