Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::commands::ChangeUuidIdentifiableObjectPropertyCommand Class Reference

Property-change command that keeps the target alive via UUID reference. More...

#include <src/commands/change_uuid_identifiable_object_property_command.h>

Inheritance diagram for zrythm::commands::ChangeUuidIdentifiableObjectPropertyCommand:
Collaboration diagram for zrythm::commands::ChangeUuidIdentifiableObjectPropertyCommand:

Public Member Functions

 ChangeUuidIdentifiableObjectPropertyCommand (utils::UuidIdentifiableBase &uuid_object, utils::IObjectRegistry &registry, QString property_name, QVariant value)
 Direct case: the UUID-identifiable object IS the target.
 ChangeUuidIdentifiableObjectPropertyCommand (utils::UuidIdentifiableBase &uuid_lifecycle_object, QObject &target, utils::IObjectRegistry &registry, QString property_name, QVariant value)
 Sub-object case: the target is a child of a UUID-identifiable object.
int id () const override
Public Member Functions inherited from zrythm::commands::ChangeQObjectPropertyCommand
 ChangeQObjectPropertyCommand (QObject &object, QString property_name, QVariant value)
int id () const override
bool mergeWith (const QUndoCommand *other) override
void undo () override
void redo () override

Static Public Attributes

static constexpr int CommandId = 1783530767

Detailed Description

Property-change command that keeps the target alive via UUID reference.

Unlike ChangeQObjectPropertyCommand (which stores a raw QObject&), this variant holds a utils::UuidReference whose RAII refcount prevents the UUID-identifiable object from being deleted while the command is on the undo stack. This makes it safe for objects whose lifetime is tied to a mutating model (e.g. automation points that can be removed by other undo commands).

The base class's raw QObject& remains valid because the UUID reference prevents the registry from deleting the object (and transitively, any sub-objects it owns).

Uses a distinct command id from ChangeQObjectPropertyCommand so the two variants never merge with each other — merging a UUID-safe command into a raw command would lose the refcount safety.

Definition at line 32 of file change_uuid_identifiable_object_property_command.h.

Constructor & Destructor Documentation

◆ ChangeUuidIdentifiableObjectPropertyCommand() [1/2]

zrythm::commands::ChangeUuidIdentifiableObjectPropertyCommand::ChangeUuidIdentifiableObjectPropertyCommand ( utils::UuidIdentifiableBase & uuid_object,
utils::IObjectRegistry & registry,
QString property_name,
QVariant value )
inline

Direct case: the UUID-identifiable object IS the target.

Parameters
uuid_objectThe UUID-identifiable object to modify and keep alive.
registryThe object registry that owns uuid_object.
property_nameThe Q_PROPERTY name to change.
valueThe new value.

Definition at line 47 of file change_uuid_identifiable_object_property_command.h.

◆ ChangeUuidIdentifiableObjectPropertyCommand() [2/2]

zrythm::commands::ChangeUuidIdentifiableObjectPropertyCommand::ChangeUuidIdentifiableObjectPropertyCommand ( utils::UuidIdentifiableBase & uuid_lifecycle_object,
QObject & target,
utils::IObjectRegistry & registry,
QString property_name,
QVariant value )
inline

Sub-object case: the target is a child of a UUID-identifiable object.

The UUID reference pins the parent alive, which transitively keeps the target alive through QObject ownership.

Parameters
uuid_lifecycle_objectThe UUID-identifiable object whose lifetime guarantees target's lifetime.
targetThe actual QObject whose property is changed.
registryThe object registry that owns uuid_lifecycle_object.
property_nameThe Q_PROPERTY name to change.
valueThe new value.

Definition at line 73 of file change_uuid_identifiable_object_property_command.h.

Member Function Documentation

◆ id()

int zrythm::commands::ChangeUuidIdentifiableObjectPropertyCommand::id ( ) const
inlineoverride

Field Documentation

◆ CommandId

int zrythm::commands::ChangeUuidIdentifiableObjectPropertyCommand::CommandId = 1783530767
staticconstexpr

The documentation for this class was generated from the following file: