diff --git a/include/qredis/client.h b/include/qredis/client.h index 8935137..e757c7a 100644 --- a/include/qredis/client.h +++ b/include/qredis/client.h @@ -23,8 +23,9 @@ namespace QRedis /** * @brief Connects to a Redis server + * @param parent the parent QObject */ - Client(); + explicit Client(QObject * parent = nullptr); /** * @brief Disconnects from the Redis server diff --git a/src/client.cpp b/src/client.cpp index 74f9955..4953f46 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -3,8 +3,8 @@ using namespace QRedis; -Client::Client() - : d(new ClientPrivate) +Client::Client(QObject * parent) + : QObject(parent), d(new ClientPrivate) { connect(&d->socket, &QTcpSocket::connected, this, &Client::connected); connect(&d->socket, &QTcpSocket::disconnected, this, &Client::disconnected);