O'Reilly logo

Learn Qt 5 by Nicholas Sherriff

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required