Descriptors
This MR is to show and discuss the new class DoubleDescriptor
. This class describes properties of a double value which are necessary to allow GUI representation, editing the value, undo/redo, unit conversion.
By using this class, the underlying data scheme is hidden from the user of the data. This e.g. eases SessionItem migration. The underlying implementation can be a SessionItem, a simple double member, or any other construction to hold a double value.
The approach allows simplifying and centralizing the access to data which is used in different spots of the UI. Defining e.g. the label, the tooltip or the internal unit at the place where the value is presented in the UI would complicate the usage of this information at a second spot in the UI (like in the sample editor and in the fit window).
The usage (non-UI still) of the descriptor is shown in the RotationItems.
This descriptor technique is to be (heavily) used in the coming layer-oriented sample editor. Descriptors for other data types (uint and string seem to be the only necessary additional types) will be added in following MRs.
Migration from SessionItem-properties to e.g. double members is very easy after using these descriptors. Only the containing classes will have to be modified (remove addProperty
calls, add sth. like double m_angle;
). The users of these classes can stay unmodified.
This MR is related to #89 (closed)