void QuickConfig::syncProperties(QObject *object) { const QMetaObject * const base = object == this ? &staticMetaObject : &QObject::staticMetaObject; const QMetaObject * const actual = object->metaObject(); int propertiesCount = actual->propertyCount(); for (int index = base->propertyCount(); index < propertiesCount; ++index) { QMetaProperty property = actual->property(index); QVariant defaultValue = property.read(object); QMetaType type(property.userType()); if (type.flags() & QMetaType::PointerToQObject) { QObject *subObject = defaultValue.value<QObject *>(); if (!subObject) { qWarning() << "QuickConfig: null value at" << this << ", property:" << property.name(); continue; } m_config.beginGroup(QLatin1String(property.name())); syncProperties(subObject); m_config.endGroup(); continue; } ConfigValue<QVariant> actualValue = m_config.value(QLatin1String(property.name()), defaultValue); property.write(object, actualValue.value()); // Store actualValue as it's destruction will drop onChange listener new QuickConfigListener(m_path, m_group, property, object, actualValue, this); actualValue.onChange(object, [object, property, defaultValue] (const QVariant &value) { property.write(object, value.isValid() ? value : defaultValue); }); } }
void RenderNode::pushStagingPropertiesChanges(TreeInfo& info) { // Push the animators first so that setupStartValueIfNecessary() is called // before properties() is trampled by stagingProperties(), as they are // required by some animators. if (CC_LIKELY(info.runAnimations)) { mAnimatorManager.pushStaging(); } if (mDirtyPropertyFields) { mDirtyPropertyFields = 0; damageSelf(info); info.damageAccumulator->popTransform(); syncProperties(); #if !HWUI_NEW_OPS applyLayerPropertiesToLayer(info); #endif // We could try to be clever and only re-damage if the matrix changed. // However, we don't need to worry about that. The cost of over-damaging // here is only going to be a single additional map rect of this node // plus a rect join(). The parent's transform (and up) will only be // performed once. info.damageAccumulator->pushTransform(this); damageSelf(info); } }
void QuickConfig::componentComplete() { syncProperties(this); }