Introducing a framework for properties in Met.3D
Reworks the property system of Met3D. See issue #354 for more info on why.
Introduces an MProperty
class for Properties.
That class is the base of various property types, such as MBoolProperty
for booleans.
Each property emits a signal when its value changes.
A callback can be registered to the signal via a helper method or the Qt connect
function.
Each property can be saved to a QSettings
object, automating saving of properties.
A property can also open a group in the settings object, where all sub-properties and itself will be saved into.
A property can be disabled and enabled.
A property can also be collapsed or expanded programatically.
Additionally, a property can be assigned a background color.
If that color is fully transparent, then the property tree color is visible in the tree instead.
Additionally, the MProperty::Editor
provides the base for the editor widgets.
They are used to edit the values of the property through GUI.
The MProperty::Editor
class is nested within the MProperty
to avoid manual instantiation of it and show its deep dependency on the property itself.
All custom properties should follow this approach.
The MPropertyTree
class provides a property tree widget, which displays the properties and their editors.
Additionally, it adds the ability to search through the property tree.
It is also possible to restrict the search to a specific sub-tree by selecting a property, and activating the search filter.
The following property types are currently implemented:
- Empty property, good for grouping
- Boolean property
- Button property
- Color property
- Enum property
- Number properties (int, float, double)
- String property
- Rect property
- Transfer function selection property
- Array property, holds multiple properties and displays them horizontally.
- QPointF property to edit points. Such are used for labels mostly.
- Actor variable property. Allows selection of actor variables.
To test this merge request, you can use the mainwindow.cpp
file, where i created a small playground for them
Obviously, these changes will be reverted before merging.
Closes #404 Also fixes #187, since the corresponding property has been reimplemented here with the needed options.