{"action":"opened","issue":{"url":"https://api.github.com/repos/emqtt/qmqtt/issues/148","repository_url":"https://api.github.com/repos/emqtt/qmqtt","labels_url":"https://api.github.com/repos/emqtt/qmqtt/issues/148/labels{/name}","comments_url":"https://api.github.com/repos/emqtt/qmqtt/issues/148/comments","events_url":"https://api.github.com/repos/emqtt/qmqtt/issues/148/events","html_url":"https://github.com/emqtt/qmqtt/issues/148","id":337697090,"node_id":"MDU6SXNzdWUzMzc2OTcwOTA=","number":148,"title":"Not connect to Host","user":{"login":"jbenfica","id":40778047,"node_id":"MDQ6VXNlcjQwNzc4MDQ3","avatar_url":"https://avatars0.githubusercontent.com/u/40778047?v=4","gravatar_id":"","url":"https://api.github.com/users/jbenfica","html_url":"https://github.com/jbenfica","followers_url":"https://api.github.com/users/jbenfica/followers","following_url":"https://api.github.com/users/jbenfica/following{/other_user}","gists_url":"https://api.github.com/users/jbenfica/gists{/gist_id}","starred_url":"https://api.github.com/users/jbenfica/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbenfica/subscriptions","organizations_url":"https://api.github.com/users/jbenfica/orgs","repos_url":"https://api.github.com/users/jbenfica/repos","events_url":"https://api.github.com/users/jbenfica/events{/privacy}","received_events_url":"https://api.github.com/users/jbenfica/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-02T23:35:35Z","updated_at":"2018-07-02T23:35:35Z","closed_at":null,"author_association":"NONE","body":"Hello, I would like help. I already compiled and installed the library, all right. The client example (which comes along) works perfectly. But when I create a project, it never connects. Below is my code, please help me.\r\n\r\n#include \"mainwindow.h\"\r\n#include \"ui_mainwindow.h\"\r\n#include <qmqtt.h>\r\n#include <QCoreApplication>\r\n#include <QTimer>\r\n\r\n\r\n\r\nQHostAddress EXAMPLE_HOST;\r\nconst quint16 EXAMPLE_PORT = 1883;\r\nconst QString EXAMPLE_TOPIC = \"temperatura\";\r\n\r\nQMQTT::Client *client = new QMQTT::Client(EXAMPLE_HOST, 1883);\r\n\r\nMainWindow::MainWindow(QWidget *parent) :\r\n    QMainWindow(parent),\r\n    ui(new Ui::MainWindow)\r\n{\r\n    ui->setupUi(this);   \r\n  \r\n\r\n    connect(client, SIGNAL(connected()), SLOT(onConnected()));\r\n    connect(client, SIGNAL(disconnected()), SLOT(timer_teste()));    \r\n}\r\n\r\nMainWindow::~MainWindow()\r\n{\r\n    delete ui;\r\n}\r\n\r\nvoid MainWindow:: timer_teste()\r\n{\r\n    qDebug() << \"desconectado\";\r\n}\r\nvoid MainWindow:: onConnected()\r\n{   \r\n    int _number=25;\r\n    QMQTT::Message message(_number, EXAMPLE_TOPIC,QString(\"Number is %1\").arg(_number).toUtf8());\r\n    client->publish(message);\r\n    qDebug() << \"entrou\";\r\n}\r\n\r\n\r\nvoid MainWindow::on_pushButton_2_clicked()\r\n{\r\n    EXAMPLE_HOST.setAddress(\"10.30.152.111\");\r\n    client->setClientId(\"clientId\");\r\n    client->setUsername(\"user\");\r\n    client->setPassword(\"password\");   \r\n    client->setHost(EXAMPLE_HOST);\r\n    client->connectToHost();\r\n    qDebug() <<\"conectado = \" << client->isConnectedToHost();\r\n}\r\n"}}
{"actor":{"display_login":"jbenfica"}}