File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#include " publisher_select_dialog.h"
22#include < QStringList>
3+ #include < QTableWidgetItem>
4+ #include < QAbstractItemView>
35
46void PublisherSelectDialog::on_lineEditFilter_textChanged (const QString &search_string)
57{
68 QStringList spaced_items = search_string.split (' ' );
79
8- for (const auto &pair : _topic_widgets )
10+ for (int row = 0 ; row < _ui-> listTopics -> rowCount (); row++ )
911 {
10- const std::string &topic_name = pair.first ;
11- QLabel *label = pair.second .first ;
12- QCheckBox *checkbox = pair.second .second ;
13-
14- QString name = QString::fromStdString (topic_name);
12+ auto item = _ui->listTopics ->item (row, 0 );
13+ QString name = item->text ();
1514 bool toHide = false ;
1615
1716 for (const auto &item : spaced_items)
@@ -22,8 +21,12 @@ void PublisherSelectDialog::on_lineEditFilter_textChanged(const QString &search_
2221 break ;
2322 }
2423 }
25-
26- label->setVisible (!toHide);
27- checkbox->setVisible (!toHide);
24+ _ui->listTopics ->setRowHidden (row, toHide);
2825 }
2926}
27+
28+ void PublisherSelectDialog::on_listTopics_itemSelectionChanged ()
29+ {
30+ QModelIndexList indexes = _ui->listTopics ->selectionModel ()->selectedIndexes ();
31+ _ui->buttonBox ->setEnabled (indexes.size () > 0 );
32+ }
You can’t perform that action at this time.
0 commit comments