BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ExternalProperty.cpp
Go to the documentation of this file.
1
// ************************************************************************************************
2
//
3
// BornAgain: simulate and fit reflection and scattering
4
//
5
//! @file GUI/coregui/Views/MaterialEditor/ExternalProperty.cpp
6
//! @brief Implements class ExternalProperty
7
//!
8
//! @homepage http://www.bornagainproject.org
9
//! @license GNU General Public License v3 or higher (see COPYING)
10
//! @copyright Forschungszentrum Jülich GmbH 2018
11
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12
//
13
// ************************************************************************************************
14
15
#include "
GUI/coregui/Views/MaterialEditor/ExternalProperty.h
"
16
#include "
GUI/coregui/Models/MaterialItem.h
"
17
#include "
GUI/coregui/Models/MaterialModel.h
"
18
19
ExternalProperty::ExternalProperty
() =
default
;
20
21
QString
ExternalProperty::text
()
const
22
{
23
return
m_text
;
24
}
25
26
void
ExternalProperty::setText
(
const
QString&
name
)
27
{
28
m_text
=
name
;
29
}
30
31
QColor
ExternalProperty::color
()
const
32
{
33
return
m_color
;
34
}
35
36
void
ExternalProperty::setColor
(
const
QColor& color)
37
{
38
m_color
=
color
;
39
}
40
41
QString
ExternalProperty::identifier
()
const
42
{
43
return
m_identifier
;
44
}
45
46
void
ExternalProperty::setIdentifier
(
const
QString& identifier)
47
{
48
m_identifier
=
identifier
;
49
}
50
51
QPixmap
ExternalProperty::pixmap
()
const
52
{
53
QPixmap
pixmap
(10, 10);
54
pixmap
.fill(
color
());
55
return
pixmap
;
56
}
57
58
//! Returns true if property is in valid state (i.e. have at least one member defined).
59
60
bool
ExternalProperty::isValid
()
const
61
{
62
if
(
m_identifier
.isEmpty() &&
m_text
.isEmpty() && !
m_color
.isValid())
63
return
false
;
64
65
return
true
;
66
}
67
68
QVariant
ExternalProperty::variant
()
const
69
{
70
QVariant
variant
;
71
variant
.setValue(*
this
);
72
return
variant
;
73
}
74
75
bool
ExternalProperty::operator==
(
const
ExternalProperty
& other)
const
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
}
86
87
bool
ExternalProperty::operator!=
(
const
ExternalProperty
& other)
const
88
{
89
return
!(*
this
== other);
90
}
91
92
bool
ExternalProperty::operator<
(
const
ExternalProperty
& other)
const
93
{
94
return
m_identifier
< other.
m_identifier
&&
m_text
< other.
m_text
;
95
}
ExternalProperty.h
Defines class ExternalProperty.
MaterialItem.h
Defines class MaterialItem.
MaterialModel.h
Defines class MaterialModel.
ExternalProperty
The ExternalProperty class defines custom QVariant property to carry the text, color and an identifie...
Definition:
ExternalProperty.h:27
ExternalProperty::m_color
QColor m_color
Definition:
ExternalProperty.h:52
ExternalProperty::identifier
QString identifier() const
Definition:
ExternalProperty.cpp:41
ExternalProperty::ExternalProperty
ExternalProperty()
ExternalProperty::variant
QVariant variant() const
Definition:
ExternalProperty.cpp:68
ExternalProperty::setColor
void setColor(const QColor &color)
Definition:
ExternalProperty.cpp:36
ExternalProperty::operator<
bool operator<(const ExternalProperty &other) const
Definition:
ExternalProperty.cpp:92
ExternalProperty::operator==
bool operator==(const ExternalProperty &other) const
Definition:
ExternalProperty.cpp:75
ExternalProperty::text
QString text() const
Definition:
ExternalProperty.cpp:21
ExternalProperty::operator!=
bool operator!=(const ExternalProperty &other) const
Definition:
ExternalProperty.cpp:87
ExternalProperty::pixmap
QPixmap pixmap() const
Definition:
ExternalProperty.cpp:51
ExternalProperty::setText
void setText(const QString &name)
Definition:
ExternalProperty.cpp:26
ExternalProperty::m_text
QString m_text
Definition:
ExternalProperty.h:51
ExternalProperty::isValid
bool isValid() const
Returns true if property is in valid state (i.e. have at least one member defined).
Definition:
ExternalProperty.cpp:60
ExternalProperty::setIdentifier
void setIdentifier(const QString &identifier)
Definition:
ExternalProperty.cpp:46
ExternalProperty::m_identifier
QString m_identifier
Definition:
ExternalProperty.h:53
ExternalProperty::color
QColor color() const
Definition:
ExternalProperty.cpp:31
RealSpace::Particles::name
QString const & name(EShape k)
Definition:
particles.cpp:21
GUI
coregui
Views
MaterialEditor
ExternalProperty.cpp
Generated by
1.9.1