32 lines
468 B
C++
32 lines
468 B
C++
|
#include "department.h"
|
||
|
|
||
|
Department::Department()
|
||
|
{}
|
||
|
|
||
|
Department::~Department()
|
||
|
{}
|
||
|
|
||
|
QString Department::name() const
|
||
|
{
|
||
|
return _name;
|
||
|
}
|
||
|
|
||
|
void Department::setName(const QString &newName)
|
||
|
{
|
||
|
_name = newName;
|
||
|
}
|
||
|
|
||
|
void Department::fromJson(const QJsonObject &json)
|
||
|
{
|
||
|
setId(json["id"].toInt());
|
||
|
setName(json["name"].toString());
|
||
|
}
|
||
|
|
||
|
QJsonObject Department::toJson() const
|
||
|
{
|
||
|
QJsonObject obj;
|
||
|
obj["id"] = id();
|
||
|
obj["name"] = name();
|
||
|
return obj;
|
||
|
}
|