Creating clients

Let’s put our new infrastructure to use and wire up the CreateClientView. If you remember, we present a save command that when clicked on, calls onCreateClientSaveExecuted() on CommandController. In order to be able to perform anything useful, CommandController needs visibility of the client instance to be serialized and saved, and an implementation of the IDatabaseController interface to perform the create operation for us.

Inject them into the constructor in command-controller.h, including any necessary headers:

explicit CommandController(QObject* _parent = nullptr, IDatabaseController* databaseController = nullptr, models::Client* newClient = nullptr);

As we’ve seen a few times now, add the member variables to Implementation ...

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.