15 #ifndef BORNAGAIN_GUI_MODEL_DESCRIPTOR_VECTORDESCRIPTOR_H
16 #define BORNAGAIN_GUI_MODEL_DESCRIPTOR_VECTORDESCRIPTOR_H
20 #include <heinz/Vectors3D.h>
36 double* zVar,
const variant<QString, Unit>& unit)
43 x.
limits = RealLimits::limitless();
44 y.
limits = RealLimits::limitless();
45 z.
limits = RealLimits::limitless();
55 const variant<QString, Unit>& unit)
59 x.
limits = RealLimits::limitless();
60 y.
limits = RealLimits::limitless();
61 z.
limits = RealLimits::limitless();
76 void init(
const QString& _label,
const QString& _tooltip,
const R3* vec,
77 const variant<QString, Unit>& _unit)
81 x.
limits = RealLimits::limitless();
82 y.
limits = RealLimits::limitless();
83 z.
limits = RealLimits::limitless();
96 x.
set = [=](
double v) {
const_cast<R3*
>(vec)->setX(v); };
97 x.
get = [=]() {
return vec->x(); };
98 x.
path = [=] {
return uid() +
"x"; };
99 y.
set = [=](
double v) {
const_cast<R3*
>(vec)->setY(v); };
100 y.
get = [=]() {
return vec->y(); };
101 y.
path = [=] {
return uid() +
"y"; };
102 z.
set = [=](
double v) {
const_cast<R3*
>(vec)->setZ(v); };
103 z.
get = [=]() {
return vec->z(); };
104 z.
path = [=] {
return uid() +
"z"; };
Defines class DoubleDescriptor.
Describes properties of a double value which are necessary to allow GUI representation,...
variant< QString, Unit > unit
Unit of the value (internal unit only!)
QString label
A label text (short, no trailing colon)
function< void(double)> set
function to set the value
RealLimits limits
Limits of the value.
function< double()> get
function to get the current value
QString tooltip
Tooltip text.
int decimals
numbers of decimals to be shown in an edit control
function< QString()> path
Path describing this value. Used e.g. for undo/redo.
Describes properties of a 3D vector, consisting of three double values.
QString tooltip
Tooltip text.
VectorDescriptor(const QString &label, const QString &tooltip, const variant< QString, Unit > &unit)
void init(const QString &_label, const QString &_tooltip, const R3 *vec, const variant< QString, Unit > &_unit)
VectorDescriptor()=default
VectorDescriptor(const QString &label, const QString &tooltip, double *xVar, double *yVar, double *zVar, const variant< QString, Unit > &unit)
function< QString()> uid
unique id describing this value. Used e.g. for undo/redo
QString label
A label text (short, no trailing colon)