itom  4.1.0
stringListDialog.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2020, Institut fuer Technische Optik (ITO),
5  Universitaet Stuttgart, Germany
6 
7  This file is part of itom and its software development toolkit (SDK).
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  In addition, as a special exception, the Institut fuer Technische
15  Optik (ITO) gives you certain additional rights.
16  These rights are described in the ITO LGPL Exception version 1.0,
17  which can be found in the file LGPL_EXCEPTION.txt in this package.
18 
19  itom is distributed in the hope that it will be useful, but
20  WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
22  General Public Licence for more details.
23 
24  You should have received a copy of the GNU Library General Public License
25  along with itom. If not, see <http://www.gnu.org/licenses/>.
26 *********************************************************************** */
27 
28 #ifndef STRINGLISTDIALOG_H
29 #define STRINGLISTDIALOG_H
30 
31 #include "ui_stringListDialog.h"
32 
33 #include <qdialog.h>
34 
35 class QListWidgetItem;
36 
37 class StringListDialog: public QDialog
38 {
39  Q_OBJECT
40 
41 public:
42  explicit StringListDialog(const QStringList &stringList, QWidget *parent);
43 
44  QListWidget *listWidget() const { return ui.listWidget; }
45  void setNewItemText(const QString &tpl) { m_newItemText = tpl; }
46  QString newItemText() const { return m_newItemText; }
47  void setCurrentIndex(int idx);
48  QStringList getStringList();
49 
50 private slots:
51  void on_newListItemButton_clicked();
52  void on_deleteListItemButton_clicked();
53  void on_moveListItemUpButton_clicked();
54  void on_moveListItemDownButton_clicked();
55  void on_listWidget_currentRowChanged();
56  void on_listWidget_itemDoubleClicked(QListWidgetItem *item);
57 
58 protected:
59  virtual void setItemData(int role, const QVariant &v);
60  virtual QVariant getItemData(int role) const;
61 
62 private:
63  void updateEditor();
64  Ui::StringListDialog ui;
65  bool m_updating;
66  QString m_newItemText;
67 };
68 
69 #endif // STRINGLISTDIALOG_H
Definition: stringListDialog.h:37