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 |
| Represents a supply or billing address |
| Represents an appointment with a client |
| 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 <data/string-decorator.h>#include <data/entity.h> namespace cm {namespace models { class CMLIBSHARED_EXPORT Address : public data::Entity{ Q_OBJECT Q_PROPERTY(cm::data::StringDecorator* ui_building MEMBER building ...