Skip to content

Instantly share code, notes, and snippets.

@alexzaporozhets
Created March 2, 2015 11:35
Show Gist options
  • Save alexzaporozhets/dc51ccb8212484e959e5 to your computer and use it in GitHub Desktop.
Save alexzaporozhets/dc51ccb8212484e959e5 to your computer and use it in GitHub Desktop.
tasks.hh
#include <QtCore>
struct Task
{
Task(const QJsonObject &jsonObj)
{
project = jsonObj["project"].toString();
name = jsonObj["name"].toString();
description = jsonObj["description"].toString();
status = jsonObj["status"].toString();
weight = jsonObj["weight"].toString();
active = jsonObj["active"].toString();
assignedTo = jsonObj["assignedTo"].toString();
QJsonArray::ConstIterator i;
QJsonArray jsonArray;
}
Task(const Task &other)
{
operator =(other);
}
Task &operator =(const Task &other)
{
project = other.project;
name = other.name;
description = other.description;
status = other.status;
weight = other.weight;
active = other.active;
assignedTo = other.assignedTo;
return *this;
}
QJsonObject toJsonObject() const
{
QJsonObject jsonObj;
jsonObj["project"] = project;
jsonObj["name"] = name;
jsonObj["description"] = description;
jsonObj["status"] = status;
jsonObj["weight"] = weight;
jsonObj["active"] = active;
jsonObj["assignedTo"] = assignedTo;
QJsonArray jsonArray;
return jsonObj;
}
QString project;
QString name;
QString description;
QString status;
QString weight;
QString active;
QString assignedTo;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment