- 
    Bug 
- 
    Resolution: Done
- 
    P3: Somewhat important 
- 
    5.11.0
- 
    None
- 
        
- 
        e023d5638bb29bb0c9b1b94ec4dde57d4b6af5ed
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.