-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpersonnode.cpp
106 lines (92 loc) · 2.18 KB
/
personnode.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#include "personnode.h"
// Qt headers
#include <QGuiApplication>
#include <QtQml>
#include <QQuickStyle>
// QuickQanava headers
#include <QuickQanava.h>
QQmlComponent* PersonNode::delegate(QQmlEngine &engine, QObject* parent) noexcept
{
Q_UNUSED(parent)
static std::unique_ptr<QQmlComponent> customRectNode_delegate;
if (!customRectNode_delegate)
customRectNode_delegate =
std::make_unique<QQmlComponent>(&engine, "qrc:/qt/qml/UntitledProject1Content/PersonNode.qml");
return customRectNode_delegate.get();
}
qan::NodeStyle *PersonNode::style(QObject* parent) noexcept
{
Q_UNUSED(parent)
static std::unique_ptr<qan::NodeStyle> customRectNode_style;
if (!customRectNode_style) {
customRectNode_style = std::make_unique<qan::NodeStyle>();
customRectNode_style->setBackColor(QColor("#ff29fc"));
}
return customRectNode_style.get();
}
void PersonNode::setName(const QString &name)
{
if(_name==name){return;}
_name=name;
emit nameChanged();
return;
}
QString PersonNode::getName() const
{
return _name;
}
void PersonNode::setSchool(const QString &school)
{
if(_school==school){return;}
_school=school;
emit schoolChanged();
return;
}
QString PersonNode::getSchool() const
{
return _school;
}
void PersonNode::setCompany(const QString &company)
{
if(_company==company){return;}
_company=company;
emit companyChanged();
return;
}
QString PersonNode::getCompany() const
{
return _company;
}
void PersonNode::setGender(const PersonNode::Gender &gender)
{
if(_gender==gender){return;}
_gender=gender;
emit genderChanged();
return;
}
PersonNode::Gender PersonNode::getGender() const
{
return _gender;
}
void PersonNode::setAge(const int &age)
{
if(_age==age){return;}
_age=age;
emit ageChanged();
return;
}
int PersonNode::getAge() const
{
return _age;
}
void PersonNode::setMotto(const QString &motto)
{
if(_motto==motto){return;}
_motto=motto;
emit mottoChanged();
return;
}
QString PersonNode::getMotto() const
{
return _motto;
}