summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMate Barany <mate.barany@qt.io>2023-06-13 15:22:09 +0200
committerMate Barany <mate.barany@qt.io>2023-06-20 10:39:45 +0200
commit6e3f752fc45b4874ec389647eb2954e76c878f3e (patch)
tree045d10a63a9eeb752d8ae945365f074840d03546 /examples
parentac62a1b927db2a83fe59f007429394e5cb1a0877 (diff)
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>
Diffstat (limited to 'examples')
-rw-r--r--examples/mqtt/quicksubscription/Main.qml19
-rw-r--r--examples/mqtt/quicksubscription/qmlmqttclient.h1
2 files changed, 12 insertions, 8 deletions
diff --git a/examples/mqtt/quicksubscription/Main.qml b/examples/mqtt/quicksubscription/Main.qml
index 9385970..df3f646 100644
--- a/examples/mqtt/quicksubscription/Main.qml
+++ b/examples/mqtt/quicksubscription/Main.qml
@@ -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
}
}
diff --git a/examples/mqtt/quicksubscription/qmlmqttclient.h b/examples/mqtt/quicksubscription/qmlmqttclient.h
index 05a86c4..5d48ae5 100644
--- a/examples/mqtt/quicksubscription/qmlmqttclient.h
+++ b/examples/mqtt/quicksubscription/qmlmqttclient.h
@@ -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);