samedi 16 juin 2018

Qmqtt QObject::connect: Cannot queue arguments of type 'ClientState' (Make sure 'ClientState' is registered using qRegisterMetaType().)

I am creating a thread and inside that thread :

m_client = new QMqttClient(this);
    m_client->setHostname("ps01.xx.com");
    m_client->setPort(1883);
    m_client->setClientId("Sas-RASPi-001");

    m_client->connectToHost();

connecting to the mqt broker.

any signal connecting attempt like :

QObject::connect(m_client, &QMqttClient::stateChanged, this, &Messenqt::updateLogStateChange);

produce an error like :

QObject::connect: Cannot queue arguments of type 'ClientState' (Make sure 'ClientState' is registered using qRegisterMetaType().)

I added :

 qRegisterMetaType<QMqttClient::ClientState>("QMqttClient::ClientState");

in the beginning of the code (above code)

still same problem.

What is the proper way to use mqt from different thread in QT signal/slot way ?

Aucun commentaire:

Enregistrer un commentaire