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

The ExternalProperty class defines custom QVariant property to carry the text, color and an identifier. More...

Public Member Functions

 ExternalProperty ()
 
QColor color () const
 
QString identifier () const
 
bool isValid () const
 Returns true if property is in valid state (i.e. have at least one member defined). More...
 
bool operator!= (const ExternalProperty &other) const
 
bool operator< (const ExternalProperty &other) const
 
bool operator== (const ExternalProperty &other) const
 
QPixmap pixmap () const
 
void setColor (const QColor &color)
 
void setIdentifier (const QString &identifier)
 
void setText (const QString &name)
 
QString text () const
 
QVariant variant () const
 

Private Attributes

QColor m_color
 
QString m_identifier
 
QString m_text
 

Detailed Description

The ExternalProperty class defines custom QVariant property to carry the text, color and an identifier.

Definition at line 27 of file ExternalProperty.h.

Constructor & Destructor Documentation

◆ ExternalProperty()

ExternalProperty::ExternalProperty ( )
explicitdefault

Member Function Documentation

◆ color()

QColor ExternalProperty::color ( ) const

◆ identifier()

◆ isValid()

bool ExternalProperty::isValid ( ) const

Returns true if property is in valid state (i.e. have at least one member defined).

Definition at line 60 of file ExternalProperty.cpp.

61 {
62  if (m_identifier.isEmpty() && m_text.isEmpty() && !m_color.isValid())
63  return false;
64 
65  return true;
66 }

References m_color, m_identifier, and m_text.

◆ operator!=()

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

Definition at line 87 of file ExternalProperty.cpp.

88 {
89  return !(*this == other);
90 }

◆ operator<()

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

Definition at line 92 of file ExternalProperty.cpp.

93 {
94  return m_identifier < other.m_identifier && m_text < other.m_text;
95 }

References m_identifier, and m_text.

◆ operator==()

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

Definition at line 75 of file ExternalProperty.cpp.

76 {
77  if (m_identifier != other.m_identifier)
78  return false;
79  if (m_text != other.m_text)
80  return false;
81  if (m_color != other.m_color)
82  return false;
83 
84  return true;
85 }

References m_color, m_identifier, and m_text.

◆ pixmap()

QPixmap ExternalProperty::pixmap ( ) const

Definition at line 51 of file ExternalProperty.cpp.

52 {
53  QPixmap pixmap(10, 10);
54  pixmap.fill(color());
55  return pixmap;
56 }
QPixmap pixmap() const
QColor color() const

References color().

Referenced by ExternalPropertyEditor::ExternalPropertyEditor(), SessionItemUtils::DecorationRole(), and ExternalPropertyEditor::initEditor().

Here is the call graph for this function:

◆ setColor()

void ExternalProperty::setColor ( const QColor &  color)

Definition at line 36 of file ExternalProperty.cpp.

37 {
38  m_color = color;
39 }

References color(), and m_color.

Referenced by MaterialItemUtils::colorProperty(), and MaterialItemUtils::materialProperty().

Here is the call graph for this function:

◆ setIdentifier()

void ExternalProperty::setIdentifier ( const QString &  identifier)

Definition at line 46 of file ExternalProperty.cpp.

47 {
49 }
QString identifier() const

References identifier(), and m_identifier.

Referenced by MaterialItemUtils::materialProperty().

Here is the call graph for this function:

◆ setText()

void ExternalProperty::setText ( const QString &  name)

Definition at line 26 of file ExternalProperty.cpp.

27 {
28  m_text = name;
29 }
QString const & name(EShape k)
Definition: particles.cpp:21

References m_text, and RealSpace::Particles::name().

Referenced by MaterialItemUtils::colorProperty(), MaterialItemUtils::materialProperty(), and SessionXML::readProperty().

Here is the call graph for this function:

◆ text()

◆ variant()

QVariant ExternalProperty::variant ( ) const

Member Data Documentation

◆ m_color

QColor ExternalProperty::m_color
private

Definition at line 52 of file ExternalProperty.h.

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

◆ m_identifier

QString ExternalProperty::m_identifier
private

Definition at line 53 of file ExternalProperty.h.

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

◆ m_text

QString ExternalProperty::m_text
private

Definition at line 51 of file ExternalProperty.h.

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


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