dialog_with_itemlist.h
Go to the documentation of this file.
1 #ifndef DIALOG_WITH_ITEMLIST_H
2 #define DIALOG_WITH_ITEMLIST_H
3 
4 #include <QDialog>
5 #include <QLabel>
6 #include <QListWidget>
7 #include <QAbstractButton>
8 #include <unordered_set>
9 
10 #include "ui_dialog_with_itemlist.h"
11 
12 namespace Ui
13 {
14 class DialogWithItemList;
15 }
16 
17 class DialogWithItemList : public QDialog
18 {
19  Q_OBJECT
20 private:
21  Ui::DialogWithItemList* ui;
22 
23 public:
24  explicit DialogWithItemList(QWidget* parent, QString title, QString text, std::unordered_set<std::string> list)
25  : QDialog(parent), ui(new Ui::DialogWithItemList)
26  {
27  QStringList name_list;
28  for (auto& name : list)
29  {
30  name_list.push_back(name.c_str());
31  }
32 
33  ui->setupUi(this);
34  this->setWindowTitle(title);
35  ui->label->setText(text);
36  ui->listWidget->addItems(name_list);
37  ui->listWidget->sortItems();
38  }
40  {
41  delete ui;
42  }
43 
44  static void warning(const QString& message, std::unordered_set<std::string> list)
45  {
46  auto dialog = new DialogWithItemList(0, tr("Warning"), message, list);
47  dialog->exec();
48  dialog->deleteLater();
49  }
50 
51 private slots:
52  void on_buttonBox_clicked(QAbstractButton* button)
53  {
54  this->close();
55  }
56 };
57 
58 #endif // DIALOG_WITH_ITEMLIST_H
DialogWithItemList::warning
static void warning(const QString &message, std::unordered_set< std::string > list)
Definition: dialog_with_itemlist.h:44
load_mode::text
@ text
DialogWithItemList
Definition: dialog_with_itemlist.h:17
Ui
DialogWithItemList::~DialogWithItemList
~DialogWithItemList()
Definition: dialog_with_itemlist.h:39
DialogWithItemList::DialogWithItemList
DialogWithItemList(QWidget *parent, QString title, QString text, std::unordered_set< std::string > list)
Definition: dialog_with_itemlist.h:24
DialogWithItemList::ui
Ui::DialogWithItemList * ui
Definition: dialog_with_itemlist.h:21
arg_id_kind::name
@ name
DialogWithItemList::on_buttonBox_clicked
void on_buttonBox_clicked(QAbstractButton *button)
Definition: dialog_with_itemlist.h:52


plotjuggler_ros
Author(s): Davide Faconti
autogenerated on Wed Feb 21 2024 03:22:55