diff --git a/GUI/Model/Types/VectorDescriptor.h b/GUI/Model/Types/VectorDescriptor.h index 921a2ab4b1c98dcaefad5847e7b646aac5149d50..a9e0daee08b94aac37c250efc0bd0a323f67b486 100644 --- a/GUI/Model/Types/VectorDescriptor.h +++ b/GUI/Model/Types/VectorDescriptor.h @@ -25,6 +25,8 @@ //! of three doubles, three double members, or any other construction to hold the three values. class VectorDescriptor { public: + VectorDescriptor() = default; + //! Operates on a VectorItem. //! //! The settings (like decimals, limits) are taken from the item. @@ -74,6 +76,7 @@ public: z.label = label + " (z)"; } + // #baMigration used? VectorDescriptor(const QString& label, const QString& tooltip, const R3* vec, const variant<QString, Unit>& unit) : label(label), tooltip(tooltip) @@ -104,6 +107,38 @@ public: z.path = [=] { return uid() + "z"; }; } + void init(const QString& _label, const QString& _tooltip, const R3* vec, + const variant<QString, Unit>& _unit) + { + label = _label; + tooltip = _tooltip; + x.limits = RealLimits::limitless(); + y.limits = RealLimits::limitless(); + z.limits = RealLimits::limitless(); + x.decimals = 3; + y.decimals = 3; + z.decimals = 3; + x.tooltip = tooltip; + y.tooltip = tooltip; + z.tooltip = tooltip; + x.unit = _unit; + y.unit = _unit; + z.unit = _unit; + x.label = label + " (x)"; + y.label = label + " (y)"; + z.label = label + " (z)"; + x.set = [=](double v) { const_cast<R3*>(vec)->setX(v); }; + x.get = [=]() { return vec->x(); }; + x.path = [=] { return uid() + "x"; }; + y.set = [=](double v) { const_cast<R3*>(vec)->setY(v); }; + y.get = [=]() { return vec->y(); }; + y.path = [=] { return uid() + "y"; }; + z.set = [=](double v) { const_cast<R3*>(vec)->setZ(v); }; + z.get = [=]() { return vec->z(); }; + z.path = [=] { return uid() + "z"; }; + } + + QString label; //!< A label text (short, no trailing colon) QString tooltip; //!< Tooltip text DoubleDescriptor x;