Finding clients

We've just successfully saved our first clients to the database, so let's now look at how we can find and view that data. We’ll encapsulate our searching functionality in a dedicated class in cm-lib, so go ahead and create a new class named ClientSearch in cm-lib/source/models.

client-search.h:

#ifndef CLIENTSEARCH_H
#define CLIENTSEARCH_H
#include <QScopedPointer>
#include <cm-lib_global.h>
#include <controllers/i-database-controller.h>
#include <data/string-decorator.h>
#include <data/entity.h>
#include <data/entity-collection.h>
#include <models/client.h>
namespace cm {
namespace models {
class CMLIBSHARED_EXPORT ClientSearch : public data::Entity
{
    Q_OBJECT
    Q_PROPERTY( cm::data::StringDecorator* ui_searchText READ 

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.