mirror of
https://github.com/qt/qtmqtt.git
synced 2026-10-25 16:16:26 +00:00
QuickSubscription Example: fix qmllint warnings
Fix the qmllint warnings in the quicksubscription example. Pick-to: 6.6 6.5 Task-number: QTBUG-110893 Change-Id: I4f633573b8c8f28eb65d7d4a57d4a63d8b7f5881 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
parent
ac62a1b927
commit
6e3f752fc4
@ -74,8 +74,8 @@ Window {
|
||||
if (client.state === MqttClient.Connected) {
|
||||
client.disconnectFromHost()
|
||||
messageModel.clear()
|
||||
tempSubscription.destroy()
|
||||
tempSubscription = 0
|
||||
root.tempSubscription.destroy()
|
||||
root.tempSubscription = 0
|
||||
} else
|
||||
client.connectToHost()
|
||||
}
|
||||
@ -94,13 +94,13 @@ Window {
|
||||
id: subField
|
||||
placeholderText: "<Subscription topic>"
|
||||
Layout.fillWidth: true
|
||||
enabled: tempSubscription === 0
|
||||
enabled: root.tempSubscription === 0
|
||||
}
|
||||
|
||||
Button {
|
||||
id: subButton
|
||||
text: "Subscribe"
|
||||
visible: tempSubscription === 0
|
||||
visible: root.tempSubscription === 0
|
||||
onClicked: {
|
||||
if (subField.text.length === 0) {
|
||||
console.log("No topic specified to subscribe to.")
|
||||
@ -115,19 +115,22 @@ Window {
|
||||
ListView {
|
||||
id: messageView
|
||||
model: messageModel
|
||||
height: 300
|
||||
width: 200
|
||||
implicitHeight: 300
|
||||
implicitWidth: 200
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
clip: true
|
||||
delegate: Rectangle {
|
||||
width: messageView.width
|
||||
id: delegatedRectangle
|
||||
required property int index
|
||||
required property string payload
|
||||
width: ListView.view.width
|
||||
height: 30
|
||||
color: index % 2 ? "#DDDDDD" : "#888888"
|
||||
radius: 5
|
||||
Text {
|
||||
text: payload
|
||||
text: delegatedRectangle.payload
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,6 +42,7 @@ class QmlMqttClient : public QObject
|
||||
Q_PROPERTY(int port READ port WRITE setPort NOTIFY portChanged)
|
||||
Q_PROPERTY(QMqttClient::ClientState state READ state WRITE setState NOTIFY stateChanged)
|
||||
QML_NAMED_ELEMENT(MqttClient)
|
||||
QML_EXTENDED_NAMESPACE(QMqttClient)
|
||||
public:
|
||||
|
||||
QmlMqttClient(QObject *parent = nullptr);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user