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, 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::string selectedTopic() const

Returns the currently selected topic. 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 datatype.

std::vector<std::string> selectedTopics() const

Returns the currently selected topics. If there is no selection, the returned vector will be empty.

Public Static Functions

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

Present the user with a dialog to select a single topic. 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 and datatype fields of the returned topic info will be empty.

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

Present the user with a dialog to select a single topic 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.

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

Present the user with a dialog to select a single topic.

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.

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

Present the user with a dialog to select a multiple topics. 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.

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

Present the user with a dialog to select a multiple topics. 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.

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

Present the user with a dialog to select a multiple topics.

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