BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ModelView::ExternalProperty Class Reference

Property to carry text, color and identifier. More...

Public Member Functions

 ExternalProperty ()
 
 ExternalProperty (std::string text, QColor color, std::string id={})
 
QColor color () const
 
std::string identifier () const
 
bool isValid () const
 
bool operator!= (const ExternalProperty &other) const
 
bool operator< (const ExternalProperty &other) const
 
bool operator== (const ExternalProperty &other) const
 
std::string text () const
 

Static Public Member Functions

static ExternalProperty undefined ()
 

Private Attributes

QColor m_color
 
std::string m_identifier
 
std::string m_text
 

Detailed Description

Property to carry text, color and identifier.

Can be used to link items with each other.

Definition at line 28 of file externalproperty.h.

Constructor & Destructor Documentation

◆ ExternalProperty() [1/2]

ExternalProperty::ExternalProperty ( )
default

Referenced by undefined().

◆ ExternalProperty() [2/2]

ExternalProperty::ExternalProperty ( std::string  text,
QColor  color,
std::string  id = {} 
)

Definition at line 21 of file externalproperty.cpp.

22  : m_text(std::move(text)), m_color(std::move(color)), m_identifier(std::move(id))
23 {
24 }

Member Function Documentation

◆ color()

QColor ExternalProperty::color ( ) const

Definition at line 36 of file externalproperty.cpp.

37 {
38  return m_color;
39 }

References m_color.

Referenced by ModelView::Utils::DecorationRole(), and TEST_F().

◆ identifier()

std::string ExternalProperty::identifier ( ) const

◆ isValid()

bool ExternalProperty::isValid ( ) const

Definition at line 46 of file externalproperty.cpp.

47 {
48  return !(m_identifier.empty() && m_text.empty() && !m_color.isValid());
49 }

References m_color, m_identifier, and m_text.

Referenced by TEST_F().

◆ operator!=()

bool ExternalProperty::operator!= ( const ExternalProperty other) const

Definition at line 56 of file externalproperty.cpp.

57 {
58  return !(*this == other);
59 }

◆ operator<()

bool ExternalProperty::operator< ( const ExternalProperty other) const

Definition at line 61 of file externalproperty.cpp.

62 {
63  return m_identifier < other.m_identifier && m_text < other.m_text
64  && m_color.name() < other.m_color.name();
65 }

References m_color, m_identifier, and m_text.

◆ operator==()

bool ExternalProperty::operator== ( const ExternalProperty other) const

Definition at line 51 of file externalproperty.cpp.

52 {
53  return m_identifier == other.m_identifier && m_text == other.m_text && m_color == other.m_color;
54 }

References m_color, m_identifier, and m_text.

◆ text()

std::string ExternalProperty::text ( ) const

Definition at line 31 of file externalproperty.cpp.

32 {
33  return m_text;
34 }

References m_text.

Referenced by TEST_F().

◆ undefined()

ExternalProperty ExternalProperty::undefined ( )
static

Definition at line 26 of file externalproperty.cpp.

27 {
28  return ExternalProperty("Undefined", QColor(Qt::red));
29 }

References ExternalProperty().

Referenced by gui2::ExperimentalScanItem::ExperimentalScanItem(), gui2::LayerItem::LayerItem(), gui2::Utils::FindProperty(), and gui2::MaterialModel::material_property().

Here is the call graph for this function:

Member Data Documentation

◆ m_color

QColor ModelView::ExternalProperty::m_color
private

Definition at line 49 of file externalproperty.h.

Referenced by color(), isValid(), operator<(), and operator==().

◆ m_identifier

std::string ModelView::ExternalProperty::m_identifier
private

Definition at line 50 of file externalproperty.h.

Referenced by identifier(), isValid(), operator<(), and operator==().

◆ m_text

std::string ModelView::ExternalProperty::m_text
private

Definition at line 48 of file externalproperty.h.

Referenced by isValid(), operator<(), operator==(), and text().


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