MQTT Subscriptions Example | Qt MQTT 6.4.1

- Qt 6.4
- Qt MQTT
- Qt MQTT Examples
- MQTT Subscriptions Example
- Qt 6.4.1 Reference Documentation

# MQTT Subscriptions 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 <QTcpSocket>
     #include <QtMqtt/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