Introduce value descriptors
This MR introduces the new classes DoubleDescriptor
and UintDescriptor
. These classes describe properties of a value (double or uint) which are necessary to allow GUI representation, editing the value, undo/redo, unit conversion.
The aim of these classes is
- Simplify session model
- Ease migration of session item (no property items will be needed any more)
- Centralize value related information
- Support uno/redo functionality
- Support unit conversion in the UI (display angstrom or nm)
- Support and simplify UI creation
By using these classes, 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 or uint member, or any other construction to hold a double or uint 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).
This descriptor technique is to be (heavily) used in the coming layer-oriented sample editor. Descriptors for other data types (string seems to be the only necessary additional type) 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)