BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
UIntProperty Class Reference

Description

Class for representing a uint value, its attributes and its accessors.

For a complete description please refer to the documentation of DoubleProperty. Everything said there also applies to this class, of course not for double values but for uint values.

See also
DoubleProperty
UIntDescriptor

Definition at line 39 of file UIntProperty.h.

Collaboration diagram for UIntProperty:
[legend]

Public Member Functions

UIntDescriptor descriptor () const
 
uint get () const
 
void init (const QString &label, const QString &tooltip, uint value, const variant< QString, Unit > &unit, const QString &persistentTag)
 
void init (const QString &label, const QString &tooltip, uint value, const variant< QString, Unit > &unit, const RealLimits &limits, const QString &persistentTag)
 
 operator uint () const
 
 operator UIntDescriptor () const
 
QString persistentTag () const
 
void set (uint d)
 
void setUid (const QString &uid)
 
QString uid () const
 

Private Attributes

UIntDescriptor m_descriptor
 
QString m_persistentTag
 
QString m_uid
 
uint m_value = 0
 

Member Function Documentation

◆ descriptor()

UIntDescriptor UIntProperty::descriptor ( ) const
inline

Definition at line 47 of file UIntProperty.h.

47 { return m_descriptor; }
UIntDescriptor m_descriptor
Definition: UIntProperty.h:62

References m_descriptor.

◆ get()

uint UIntProperty::get ( ) const
inline

Definition at line 51 of file UIntProperty.h.

51 { return m_value; }

References m_value.

Referenced by Serialize::rwProperty().

◆ init() [1/2]

void UIntProperty::init ( const QString &  label,
const QString &  tooltip,
uint  value,
const variant< QString, Unit > &  unit,
const QString &  persistentTag 
)

Definition at line 20 of file UIntProperty.cpp.

22 {
23  init(label, tooltip, value, unit, RealLimits::nonnegative(), persistentTag);
24 }
QString persistentTag() const
Definition: UIntProperty.h:53
void init(const QString &label, const QString &tooltip, uint value, const variant< QString, Unit > &unit, const QString &persistentTag)

References persistentTag().

Referenced by InterferenceFinite2DLatticeItem::InterferenceFinite2DLatticeItem(), and LayerItem::LayerItem().

Here is the call graph for this function:

◆ init() [2/2]

void UIntProperty::init ( const QString &  label,
const QString &  tooltip,
uint  value,
const variant< QString, Unit > &  unit,
const RealLimits &  limits,
const QString &  persistentTag 
)

Definition at line 26 of file UIntProperty.cpp.

29 {
30  m_value = value;
32  m_uid = QUuid::createUuid().toString();
33 
34  m_descriptor.label = label;
35  m_descriptor.tooltip = tooltip;
36  m_descriptor.limits = limits;
37  m_descriptor.unit = unit;
38  m_descriptor.set = [=](double v) { m_value = v; };
39  m_descriptor.get = [=] { return m_value; };
40  m_descriptor.path = [=] { return m_uid; };
41 }
QString label
A label text (short, no trailing colon)
function< void(uint)> set
function to set the value
variant< QString, Unit > unit
Unit of the value (internal unit only!)
QString tooltip
Tooltip text.
RealLimits limits
Limits of the value.
function< QString()> path
Path describing this value. Used e.g. for undo/redo.
function< uint()> get
function to get the current value
QString m_uid
Definition: UIntProperty.h:60
QString m_persistentTag
Definition: UIntProperty.h:59

References UIntDescriptor::get, UIntDescriptor::label, UIntDescriptor::limits, m_descriptor, m_persistentTag, m_uid, m_value, UIntDescriptor::path, persistentTag(), UIntDescriptor::set, UIntDescriptor::tooltip, and UIntDescriptor::unit.

Here is the call graph for this function:

◆ operator uint()

UIntProperty::operator uint ( ) const
inline

Definition at line 49 of file UIntProperty.h.

49 { return m_value; }

References m_value.

◆ operator UIntDescriptor()

UIntProperty::operator UIntDescriptor ( ) const
inline

Definition at line 48 of file UIntProperty.h.

48 { return m_descriptor; }

References m_descriptor.

◆ persistentTag()

QString UIntProperty::persistentTag ( ) const
inline

Definition at line 53 of file UIntProperty.h.

53 { return m_persistentTag; }

References m_persistentTag.

Referenced by init(), and Serialize::rwProperty().

◆ set()

void UIntProperty::set ( uint  d)
inline

◆ setUid()

void UIntProperty::setUid ( const QString &  uid)
inline

Definition at line 55 of file UIntProperty.h.

55 { m_uid = uid; }
QString uid() const
Definition: UIntProperty.h:54

References m_uid, and uid().

Referenced by Serialize::rwProperty().

Here is the call graph for this function:

◆ uid()

QString UIntProperty::uid ( ) const
inline

Definition at line 54 of file UIntProperty.h.

54 { return m_uid; }

References m_uid.

Referenced by Serialize::rwProperty(), and setUid().

Member Data Documentation

◆ m_descriptor

UIntDescriptor UIntProperty::m_descriptor
private

Definition at line 62 of file UIntProperty.h.

Referenced by descriptor(), init(), and operator UIntDescriptor().

◆ m_persistentTag

QString UIntProperty::m_persistentTag
private

Definition at line 59 of file UIntProperty.h.

Referenced by init(), and persistentTag().

◆ m_uid

QString UIntProperty::m_uid
private

Definition at line 60 of file UIntProperty.h.

Referenced by init(), setUid(), and uid().

◆ m_value

uint UIntProperty::m_value = 0
private

Definition at line 58 of file UIntProperty.h.

Referenced by get(), init(), operator uint(), and set().


The documentation for this class was generated from the following files: