mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2025-11-06 19:14:57 +11:00
core/reloader: fix late creation of Reloadable types
This commit is contained in:
parent
61812343f5
commit
6eb68d2cd7
13 changed files with 87 additions and 48 deletions
|
|
@ -23,13 +23,11 @@ void LazyLoader::onReload(QObject* oldInstance) {
|
|||
|
||||
if (this->mItem != nullptr) {
|
||||
if (auto* reloadable = qobject_cast<Reloadable*>(this->mItem)) {
|
||||
reloadable->onReload(old == nullptr ? nullptr : old->mItem);
|
||||
reloadable->reload(old == nullptr ? nullptr : old->mItem);
|
||||
} else {
|
||||
Reloadable::reloadRecursive(this->mItem, old);
|
||||
}
|
||||
}
|
||||
|
||||
this->postReload = true;
|
||||
}
|
||||
|
||||
QObject* LazyLoader::item() {
|
||||
|
|
@ -48,14 +46,6 @@ void LazyLoader::setItem(QObject* item) {
|
|||
|
||||
if (item != nullptr) {
|
||||
item->setParent(this);
|
||||
|
||||
if (this->postReload) {
|
||||
if (auto* reloadable = qobject_cast<Reloadable*>(this->mItem)) {
|
||||
reloadable->onReload(nullptr);
|
||||
} else {
|
||||
Reloadable::reloadRecursive(this->mItem, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->targetActive = this->isActive();
|
||||
|
|
@ -160,7 +150,7 @@ void LazyLoader::setSource(QString source) {
|
|||
}
|
||||
|
||||
void LazyLoader::incubateIfReady(bool overrideReloadCheck) {
|
||||
if (!(this->postReload || overrideReloadCheck) || !(this->targetLoading || this->targetActive)
|
||||
if (!(this->reloadComplete || overrideReloadCheck) || !(this->targetLoading || this->targetActive)
|
||||
|| this->mComponent == nullptr || this->incubator != nullptr)
|
||||
{
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue