forked from quickshell/quickshell
refactor(wayland): seperate cmake files for modularity
This commit is contained in:
parent
5bbd0333ef
commit
c6dde9ca9d
28 changed files with 32 additions and 33 deletions
24
src/core/persistentprops.cpp
Normal file
24
src/core/persistentprops.cpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#include "persistentprops.hpp"
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
void PersistentProperties::onReload(QObject* oldInstance) {
|
||||
if (qobject_cast<PersistentProperties*>(oldInstance) == nullptr) {
|
||||
emit this->loaded();
|
||||
return;
|
||||
}
|
||||
|
||||
const auto* metaObject = this->metaObject();
|
||||
for (auto i = metaObject->propertyOffset(); i < metaObject->propertyCount(); i++) {
|
||||
const auto prop = metaObject->property(i);
|
||||
auto oldProp = oldInstance->property(prop.name());
|
||||
|
||||
if (oldProp.isValid()) {
|
||||
this->setProperty(prop.name(), oldProp);
|
||||
}
|
||||
}
|
||||
|
||||
emit this->loaded();
|
||||
emit this->reloaded();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue