Entities

As we have a lot of functionality we want to share across our data models, we'll implement an Entity base class. We need to be able to represent parent/child relationships so that a client can have supply and billing addresses. We also need to support collections of entities for our contacts and appointments. Finally, each entity hierarchy must be able to serialize itself to and from a JSON object.

Create a new class Entity in cm-lib/source/data.

entity.h:

#ifndef ENTITY_H
#define ENTITY_H
#include <map>
#include <QObject>
#include <QScopedPointer>
#include <cm-lib_global.h>
#include <data/data-decorator.h>
namespace cm {
namespace data {
class CMLIBSHARED_EXPORT Entity : public QObject
{
    Q_OBJECT
public:
 Entity(QObject* parent ...

Get Learn Qt 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.