Simple MQTT Client Example

 // Copyright (C) 2017 The Qt Company Ltd.
 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

 #ifndef MAINWINDOW_H
 #define MAINWINDOW_H

 #include <QMainWindow>
 #include <QMqttClient>

 namespace Ui {
 class MainWindow;
 }

 class MainWindow : public QMainWindow
 {
     Q_OBJECT

 public:
     explicit MainWindow(QWidget *parent = nullptr);
     ~MainWindow();

 public slots:
     void setClientPort(int p);

 private slots:
     void on_buttonConnect_clicked();
     void on_buttonQuit_clicked();
     void updateLogStateChange();

     void brokerDisconnected();

     void on_buttonPublish_clicked();

     void on_buttonSubscribe_clicked();

 private:
     Ui::MainWindow *ui;
     QMqttClient *m_client;
 };

 #endif // MAINWINDOW_H