Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-69066

mqtt publish returns -1 in QML

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 5.11.0
    • Fix Version/s: 5.11.2, 5.12.0 Alpha
    • Component/s: MQTT
    • Labels:
      None
    • Platform/s:
      Linux/X11, Windows
    • Commits:
      e023d5638bb29bb0c9b1b94ec4dde57d4b6af5ed

      Description

      When adding the publish method to main.qml in example: https://doc.qt.io/QtMQTT/qtmqtt-quicksubscription-example.html, a -1 (error) is returned.

       
      MqttClient {
              id: mqttclient
              port: 1883
              hostname: "localhost"
          }
       
          Button {
              id: connect
              text: qsTr("Connect")
              onClicked: {
                  console.log(mqttclient.connectToHost())
              }
          }

          Button {
              id: publish
               text: qsTr("publish")
              onClicked: {
                  console.log(mqttclient.publish("mytopic","mytestmessage"))
              }
          }
       
      As suggested by Maurice Kalinowsky, this is mostly caused by a failing auto-conversion from QString to QMqttTopicName.
       

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            mkalinow Maurice Kalinowski
            Reporter:
            eggn1n3 Rene Kogels
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes