Getting Started with Enginio using C++ | Enginio Manual 1.6

Qt 1.6 | Enginio Manual | Getting Started with Enginio using C++

Qt 1.6.2 Reference Documentation

Getting Started with Enginio using Qt Quick ◦ Checking Stored Objects in the Dashboard

# Getting Started with Enginio using C++

## Setup Qt Application Project

To link to Enginio in a qmake-based project, add the line shown below to the `.pro` file.

      QT += enginio

## Initialize Enginio Client

To use the Enginio library, the required library headers must be included.

      #include <Enginio/Enginio>

Then an EnginioClient must be instantiated. The client requires a `backend id`, which can be copied from the Dashboard. Go to the Enginio Dashboard and select a backend. Copy the backend id value.

      QByteArray backendId("YOUR_OWN_BACKEND_ID");
      EnginioClient *client = new EnginioClient;
      client->setBackendId(backendId);

For testing purposes, it is easiest to hardcode the backend id directly into application code. However, this might not be always the best choice, and sometimes it might be beneficial to put the backend configuration in a separate configuration file.

## Storing the First Object

Create an object in JSON format and fill in the data:

      QJsonObject city;
      city.insert("objectType", QString("objects.city")); // an object type is required for all objects in Enginio
      city.insert("name", QString("Oslo")); // other properties can be chosen freely
      city.insert("population", 624000);

Create the object in the Enginio database by calling EnginioClient::create():

      client->create(city);
      connect(client, SIGNAL(finished(EnginioReply*)), this, SLOT(uploadFinished(EnginioReply*)));

Note that the create() method performs the actual asynchronous network communication. Wait for completion by connecting to the finished and error signals.

Check the Enginio dashboard for the newly created object.

Getting Started with Enginio using Qt Quick ◦ Checking Stored Objects in the Dashboard