1
0
mirror of https://github.com/qt/qtmqtt.git synced 2026-10-25 16:16:26 +00:00

Make enums and functions exposable to QML

While there is no existing API to QML, exposing connectToHost and others
helps in exporting QMqttClient to QML.

Change-Id: I9f71cb589be75e90e9b40d78cc32d25aa08e4f72
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
This commit is contained in:
Maurice Kalinowski 2017-06-13 17:40:24 +02:00
parent 9b69b854dd
commit ea3dc64d3f
2 changed files with 5 additions and 3 deletions

View File

@ -53,6 +53,7 @@ public:
private:
Q_OBJECT
Q_ENUMS(State)
Q_PROPERTY(QString clientId READ clientId WRITE setClientId NOTIFY clientIdChanged)
Q_PROPERTY(QString hostname READ hostname WRITE setHostname NOTIFY hostnameChanged)
Q_PROPERTY(quint16 port READ port WRITE setPort NOTIFY portChanged)
@ -85,9 +86,9 @@ public:
quint16 keepAlive() const;
ProtocolVersion protocolVersion() const;
void connectToHost();
void connectToHostEncrypted(const QString &sslPeerName = QString());
void disconnectFromHost();
Q_INVOKABLE void connectToHost();
Q_INVOKABLE void connectToHostEncrypted(const QString &sslPeerName = QString());
Q_INVOKABLE void disconnectFromHost();
State state() const;

View File

@ -35,6 +35,7 @@ class QMqttSubscriptionPrivate;
class Q_MQTT_EXPORT QMqttSubscription : public QObject
{
Q_OBJECT
Q_ENUMS(SubscriptionState)
Q_PROPERTY(SubscriptionState state READ state WRITE setState NOTIFY stateChanged)
Q_PROPERTY(quint8 qos READ qos NOTIFY qosChanged)
Q_PROPERTY(QString topic READ topic)