Class SelectTopicDialog

Inheritance Relationships

Base Type

  • public QDialog

Class Documentation

class SelectTopicDialog : public QDialog

Provides a dialog for the user to select one or more topics. Several static functions are provided that can be used instead of instantiating the class directly.

Public Functions

explicit SelectTopicDialog(const rclcpp::Node::SharedPtr &node, const rmw_qos_profile_t &qos, QWidget *parent = nullptr)

Constructor for the SelectTopicDialog.

void allowMultipleTopics(bool allow)

Choose whether the user can select one (allow=false) or multiple (allow=true) topics. The default is false.

void setDatatypeFilter(const std::vector<std::string> &datatypes)

Set a datatype filter to limit displayed topics based on their types. If the vector is empty (default), the dialog will display all available topics.

std::pair<std::string, rmw_qos_profile_t> selectedTopic() const

Returns the currently selected topic and QoS profile. If multiple topics are allowed, this will only return the first selected element. If there is no selection, the returned info will have an empty topic name and default QoS profile.

std::pair<std::vector<std::string>, rmw_qos_profile_t> selectedTopics() const

Returns the currently selected topics and QoS setting. If there is no selection, the returned vector will be empty and the QoS will be the RMW default.

Public Static Functions

static std::pair<std::string, rmw_qos_profile_t> selectTopic(const rclcpp::Node::SharedPtr &node, const std::string &datatype, const rmw_qos_profile_t &qos, QWidget *parent = nullptr)

Present the user with a dialog to select a single topic and configure QoS settings. This is convenience wrapper for the common case where only one datatype is allowed.

If the user cancels the selection or doesn’t make a valid selection, the topic will be empty and the QoS will be the RMW default.

static std::pair<std::string, rmw_qos_profile_t> selectTopic(const rclcpp::Node::SharedPtr &node, const std::string &datatype1, const std::string &datatype2, const rmw_qos_profile_t &qos, QWidget *parent = nullptr)

Present the user with a dialog to select a single topic and configure QoS settings. This is a convenience wrapper for the common case where two datatypes are allowed.

If the user cancels the selection or doesn’t make a valid selection, the topic and datatype fields of the returned topic info will be empty, and the QoS will be the RMW defaults.

static std::pair<std::string, rmw_qos_profile_t> selectTopic(const rclcpp::Node::SharedPtr &node, const std::vector<std::string> &datatypes, const rmw_qos_profile_t &qos, QWidget *parent = nullptr)

Present the user with a dialog to select a single topic and configure QoS settings.

If the user cancels the selection or doesn’t make a valid selection, the topic will be an empty string the QoS will be RMW defaults.

static std::pair<std::vector<std::string>, rmw_qos_profile_t> selectTopics(const rclcpp::Node::SharedPtr &node, const std::string &datatype, const rmw_qos_profile_t &qos, QWidget *parent = nullptr)

Present the user with a dialog to select a multiple topics and configure QoS settings. This is a convenience wrapper for the common case where only one datatype is allowed.

If the user cancels the selection or doesn’t make a valid selection, the returned vector will be empty, and the QoS will be the RMW default.

static std::pair<std::vector<std::string>, rmw_qos_profile_t> selectTopics(const rclcpp::Node::SharedPtr &node, const std::string &datatype1, const std::string &datatype2, const rmw_qos_profile_t &qos, QWidget *parent = nullptr)

Present the user with a dialog to select a multiple topics and configure QoS. This is a convenience wrapper for the common case where two datatypes are allowed.

If the user cancels the selection or doesn’t make a valid selection, the returned vector will be empty and the QoS will be the RMW default.

static std::pair<std::vector<std::string>, rmw_qos_profile_t> selectTopics(const rclcpp::Node::SharedPtr &node, const std::vector<std::string> &datatypes, const rmw_qos_profile_t &qos, QWidget *parent = nullptr)

Present the user with a dialog to select a multiple topics and configure QoS settings..

If the user cancels the selection or doesn’t make a valid selection, the returned vector will be empty and the QoS will be the RMW defaults.