title: QMqttSubscriber not printing received messages
body: <p>I am working on a mqtt project using QT. The publisher works fine which opens and closes a lock controlled by an raspi3, but I also need to subscribe a topic and need to start another action when the subscribed topic responses. I did a first small example as well, before starting to implement it in the bigger project which worked there fine. 
  But not in this project. Am I missing something? </p>
  
  <p>Here are the relevant snippets from my code:</p>
  
  <p>HMIController.cpp</p>
  
  <pre><code>QmlMqttClient *HMIController::createClient()
  {
  
  mqttClient = new QmlMqttClient;
  mqttClient-&gt;handleSub();
  
  return mqttClient;
  
  }
  </code></pre>
  
  <p>qmlmqttclient.h</p>
  
  <pre><code>#ifndef QMLMQTTCLIENT_H
  #define QMLMQTTCLIENT_H
  
  #include &lt;QtCore/QMap&gt;
  #include &lt;QtMqtt/QMqttClient&gt;
  #include &lt;QtMqtt/QMqttSubscription&gt;
  #include &lt;QtMqtt/QMqttMessage&gt;
  
  class QmlMqttClient;
  
  class QmlMqttClient : public QMqttClient
  {
  Q_OBJECT
  
  public:
  QmlMqttClient(QObject *parent = nullptr);
  
  QMqttSubscription *QmlMqttClient::subscribe(const QMqttTopicFilter &amp;topic, quint8 qos = 0);
  Q_INVOKABLE qint32 publish(const QMqttTopicName &amp;topic, const QByteArray &amp;message = QByteArray(),
                             quint8 qos = 0, bool retain = false);
  
  public slots:
  void handleOpen();
  void handleClose();
  void handleSub();
  
  private:
  Q_DISABLE_COPY(QmlMqttClient)
  
  private slots:
  void brokerDisconnected();
  
  };
  
  #endif // QMLMQTTCLIENT_H
  </code></pre>
  
  <p>qmlmqttclient.cpp</p>
  
  <pre><code>#include &lt;QtMqtt/QMqttSubscription&gt;
  #include &lt;QtMqtt/QMqttTopicFilter&gt;
  #include &lt;QMqttTopicName&gt;
  #include &lt;QtMqtt/QMqttClient&gt;
  #include &lt;QMqttClient&gt;
  #include &lt;QMqttSubscription&gt;
  #include &lt;QDateTime&gt;
  #include &lt;QDebug&gt;
  #include &lt;QtQuick&gt;
  
  #include "qmlmqttclient.h"
  #include "hmicontroller.h"
  
  QmlMqttClient::QmlMqttClient( QObject *parent)
      : QMqttClient(parent)
  {
  
      this-&gt;setHostname("192.168.137.82");
      this-&gt;setPort(1883);
      this-&gt;connectToHost();
  
      if (ClientState::Disconnected)
      {
          connect(this, &amp;QmlMqttClient::disconnected, this, &amp;QmlMqttClient::brokerDisconnected);
          qDebug() &lt;&lt; "Broker disconnected";
      } else if (ClientState::Connecting)
      {
          qDebug() &lt;&lt; "Connecting to MqttBroker ..." &lt;&lt; this-&gt;clientId();
      }
  
  connect(this, &amp;QMqttClient::messageReceived, this, [this](const QByteArray &amp;message, const QMqttTopicName &amp;topic) {
      qDebug() &lt;&lt; QDateTime::currentDateTime().toString()
                  + QLatin1String(" Received Topic: ")
                  + topic.name()
                  + QLatin1String(" Message: ")
                  + message
                  + QLatin1Char('\n');
  
  });
  
  }
  
  qint32 QmlMqttClient::publish(const QMqttTopicName &amp;topic, const QByteArray &amp;message,
                                quint8 qos, bool retain)
  {
      return QMqttClient::publish(topic, message, qos, retain);
  }
  
  void QmlMqttClient::handleOpen()
  {
      QString msg = "AUF";
      const QMqttTopicName *topic = new QMqttTopicName("lock");
      publish(*topic, msg.toUtf8() ,0);
  }
  
  void QmlMqttClient::handleClose()
  {
      QString msg = "ZU";
      const QMqttTopicName *topic = new QMqttTopicName("lock");
      publish(*topic, msg.toUtf8() ,0);
  }
  
  QMqttSubscription *QmlMqttClient::subscribe(const QMqttTopicFilter &amp;topic, quint8 qos)
  {
      qDebug() &lt;&lt; "Subscribed" &lt;&lt; this-&gt;clientId();
      return QMqttClient::subscribe(topic, qos);
  }
  
  //Called from hmicontroller
  void QmlMqttClient::handleSub()
  {
      const QMqttTopicFilter *topic = new QMqttTopicFilter("button");
  
      subscribe(*topic, quint8(0));
  
      qDebug() &lt;&lt; "Subscribed";
  }
  
  
  
  void QmlMqttClient::brokerDisconnected()
  {
      qDebug() &lt;&lt; "Session closed";
  }
  </code></pre>
  
  <p>Thanks a lot for your help and by the way, I am also new to c++ and qt. So excuse any not so nice written code. </p>