55#include < QFormLayout>
66#include < QCheckBox>
77#include < QLabel>
8+ #include < QLineEdit>
89#include < QHBoxLayout>
910#include < QVBoxLayout>
1011#include < QDialogButtonBox>
@@ -155,6 +156,7 @@ void TopicPublisherROS2::filterDialog()
155156 std::map<std::string, QCheckBox*> checkbox;
156157
157158 std::map<std::string, QCheckBox *> checkbox;
159+ std::map<std::string, std::pair<QLabel *, QCheckBox *>> topic_widgets;
158160
159161 for (const TopicInfo &info : sorted_topics)
160162 {
@@ -170,14 +172,23 @@ void TopicPublisherROS2::filterDialog()
170172 cb->setChecked (filter_it->second );
171173 }
172174 cb->setFocusPolicy (Qt::NoFocus);
173- dialog->ui ()->formLayout ->addRow (new QLabel (QString::fromStdString (topic_name)), cb);
175+ auto label = new QLabel ();
176+ label->setTextFormat (Qt::RichText);
177+ label->setText (QString (" <a href=\" #\" >%1</a>" ).arg (QString::fromStdString (topic_name)));
178+ label->setOpenExternalLinks (false );
179+ dialog->ui ()->formLayout ->addRow (label, cb);
174180 checkbox.insert (std::make_pair (topic_name, cb));
181+ topic_widgets.insert (std::make_pair (topic_name, std::make_pair (label, cb)));
182+ connect (label, &QLabel::linkActivated, [cb]()
183+ { cb->toggle (); });
175184 connect (dialog->ui ()->pushButtonSelect , &QPushButton::pressed, [cb]()
176185 { cb->setChecked (true ); });
177186 connect (dialog->ui ()->pushButtonDeselect , &QPushButton::pressed, [cb]()
178187 { cb->setChecked (false ); });
179188 }
180189
190+ dialog->setTopicWidgets (topic_widgets);
191+
181192 dialog->exec ();
182193
183194 if (dialog->result () == QDialog::Accepted)
0 commit comments