Variant class
Wednesday, December 15, 2021
When one Attribute replaces its value with another Attribute, they should each have the same value but still be able to have independent active states. The active state of an Attribute is dependent on the active state of its parent Themeable, and if the two Attributes referring to the same value belong to different Themeables, then they should be able to be in different states.
Now there is a Variant class that wraps a QVariant to give it signal/slot functionality. An Attribute's m_variant can be swapped out with the m_variant of another Attribute. When an Attribute receives a pointer to a different variant, the Variant::changed signal needs to be connected to emit the Attribute's value_changed signal.
How should this work with states?
First, keep track of how things are stored within the Attribute class. An Attribute stores either a pointer to a Variant or a pointer to a QMap pairing QStrings (states) with Variants.
If an Attribute stores a pointer to a state-variant map, all of the Variants' changed signals should be connected to emit the Attribute::value_changed signal.