Data models

Now that we have the infrastructure in place to be able to define data objects (entities and entity collections) and properties of various types (data decorators), we can move on and build the object hierarchy we laid out earlier in the chapter. We already have a default Client class created by Qt Creator, so supplement that in cm-lib/source/models with the following new classes:

Class

Purpose

Address

Represents a supply or billing address

Appointment

Represents an appointment with a client

Contact

Represents a method of contacting a client

 

We’ll start with the simplest of the models—the address.

address.h:

#ifndef ADDRESS_H
#define ADDRESS_H
#include <QObject>
#include <cm-lib_global.h>
#include ...

Get End to End GUI Development with Qt5 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.