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 class DialogWithItemList;
14 }
15 
16 class DialogWithItemList : public QDialog
17 {
18  Q_OBJECT
19 private:
20  Ui::DialogWithItemList *ui;
21 
22 public:
23  explicit DialogWithItemList(QWidget *parent, QString title, QString text,
24  std::unordered_set<std::string> list) :
25  QDialog(parent),
26  ui(new Ui::DialogWithItemList)
27  {
28  QStringList name_list;
29  for(auto& name: list)
30  {
31  name_list.push_back( name.c_str() );
32  }
33 
34  ui->setupUi(this);
35  this->setWindowTitle(title);
36  ui->label->setText(text);
37  ui->listWidget->addItems(name_list);
38  ui->listWidget->sortItems();
39  }
41  {
42  delete ui;
43  }
44 
45  static void warning(const QString& message, std::unordered_set<std::string> list)
46  {
47  auto dialog = new DialogWithItemList(0, tr("Warning"), message, list );
48  dialog->exec();
49  dialog->deleteLater();
50  }
51 
52 private slots:
53  void on_buttonBox_clicked(QAbstractButton *button)
54  {
55  this->close();
56  }
57 };
58 
59 #endif // DIALOG_WITH_ITEMLIST_H
Ui::DialogWithItemList * ui
void on_buttonBox_clicked(QAbstractButton *button)
char name[1]
static void warning(const QString &message, std::unordered_set< std::string > list)
DialogWithItemList(QWidget *parent, QString title, QString text, std::unordered_set< std::string > list)


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17