class QMqttTopicName#

The QMqttTopicName class represents a MQTT topic name. More

Synopsis#

Methods#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

QMqttTopicName is a thin wrapper around a QString providing an expressive data type for MQTT topic names. Beside the benefits of having a strong type preventing unintended misuse, QMqttTopicName provides convenient functions related to topic names like isValid() or levels() .

See also

QMqttTopicFilter

__init__(name)#
Parameters:

nameQLatin1String

Creates a new MQTT topic name with the specified name.

__init__(name)
Parameters:

nameQMqttTopicName

Creates a new MQTT topic name as a copy of name.

__init__([name=""])
Parameters:

name – str

Creates a new MQTT topic name with the specified name.

isValid()#
Return type:

bool

Returns true if the topic name is valid according to the MQTT standard section 4.7, or false otherwise.

levelCount()#
Return type:

int

Returns the total number of topic levels.

levels()#
Return type:

list of strings

Returns the topic levels.

name()#
Return type:

str

Returns the topic name.

See also

setName()

__ne__(rhs)#
Parameters:

rhsQMqttTopicName

Return type:

bool

Returns true if the topic names lhs and rhs are different, otherwise returns false.

setName(name)#
Parameters:

name – str

Sets the topic name to name.

See also

name()

swap(other)#
Parameters:

otherQMqttTopicName

Swaps the MQTT topic name other with this MQTT topic name. This operation is very fast and never fails.