summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMate Barany <mate.barany@qt.io>2023-06-16 16:33:58 +0200
committerMate Barany <mate.barany@qt.io>2023-06-20 13:53:31 +0200
commita6581736ff7a12121e705caaa543856534f39b84 (patch)
tree1239bbf9cef754bef8471bc04051b2aea16ea948 /examples
parentf49eaa9b7a56da90836d2fe576a033da68c3bb3c (diff)
QuickPublication Example: fix qmllint warnings
Fix the qmllint warnings in the quickpublication example. Pick-to: 6.6 6.5 Task-number: QTBUG-110893 Change-Id: If78a908807ee8a5f6f693d159a05a9ee91b1e38d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/mqtt/quickpublication/Main.qml13
-rw-r--r--examples/mqtt/quickpublication/qmlmqttclient.h1
2 files changed, 9 insertions, 5 deletions
diff --git a/examples/mqtt/quickpublication/Main.qml b/examples/mqtt/quickpublication/Main.qml
index 0c5cb00..65ae93b 100644
--- a/examples/mqtt/quickpublication/Main.qml
+++ b/examples/mqtt/quickpublication/Main.qml
@@ -130,7 +130,7 @@ Window {
return
}
client.publish(pubField.text, msgField.text, qosItems.currentText, retain.checked)
- addMessage(msgField.text)
+ root.addMessage(msgField.text)
}
}
}
@@ -138,19 +138,22 @@ Window {
ListView {
id: messageView
model: messageModel
- height: 300
- width: 200
+ implicitHeight: 300
+ implicitWidth: 200
Layout.fillHeight: true
Layout.fillWidth: true
Layout.columnSpan: 2
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/quickpublication/qmlmqttclient.h b/examples/mqtt/quickpublication/qmlmqttclient.h
index bb91761..aac08cd 100644
--- a/examples/mqtt/quickpublication/qmlmqttclient.h
+++ b/examples/mqtt/quickpublication/qmlmqttclient.h
@@ -16,6 +16,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);