Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef OPENMS_VISUAL_LISTEDITOR_H
00036 #define OPENMS_VISUAL_LISTEDITOR_H
00037
00038
00039 #include <OpenMS/DATASTRUCTURES/StringList.h>
00040 #include <QtGui/QDialog>
00041 #include <QtGui/QListWidget>
00042 #include <QtGui/QItemDelegate>
00043
00044 class QPushButton;
00045
00046 namespace OpenMS
00047 {
00048 namespace Internal
00049 {
00050 class ListTable;
00051 class ListEditorDelegate;
00052 }
00053
00057 class OPENMS_GUI_DLLAPI ListEditor :
00058 public QDialog
00059 {
00060 Q_OBJECT
00061
00062 public:
00063
00064 enum Type
00065 {
00066 INT,
00067 FLOAT,
00068 STRING,
00069 OUTPUT_FILE,
00070 INPUT_FILE
00071 };
00072
00074 ListEditor(QWidget * parent = 0, QString title = "");
00076 StringList getList() const;
00078 void setList(const StringList & list, ListEditor::Type type);
00080 void setListRestrictions(const String & restrictions);
00082 void setTypeName(QString name);
00083
00084 private:
00086 ListEditor::Type type_;
00088 Internal::ListTable * listTable_;
00090 Internal::ListEditorDelegate * listDelegate_;
00092 QPushButton * newRowButton_;
00094 QPushButton * removeRowButton_;
00096 QPushButton * OkButton_;
00098 QPushButton * CancelButton_;
00099 };
00100
00105 namespace Internal
00106 {
00107 class OPENMS_GUI_DLLAPI ListTable :
00108 public QListWidget
00109 {
00110 Q_OBJECT
00111
00112 public:
00113
00114
00115 ListTable(QWidget * parent = 0);
00116
00117
00118 StringList getList();
00119
00120
00121 void setList(const StringList & list, ListEditor::Type type);
00122
00123 public slots:
00124 void createNewRow();
00125 void removeCurrentRow();
00126
00127 private:
00129 ListEditor::Type type_;
00130
00131 StringList list_;
00132 };
00133
00139 class OPENMS_GUI_DLLAPI ListEditorDelegate :
00140 public QItemDelegate
00141 {
00142 Q_OBJECT
00143
00144 public:
00146 ListEditorDelegate(QObject * parent);
00148 QWidget * createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const;
00150 void setEditorData(QWidget * editor, const QModelIndex & index) const;
00152 void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const;
00154 void updateEditorGeometry(QWidget * editor, const QStyleOptionViewItem & option, const QModelIndex & index) const;
00155
00156
00157 void setType(const ListEditor::Type type);
00158
00159 void setRestrictions(const String & restrictions);
00161 void setTypeName(QString name);
00163 void setFileName(QString name);
00164
00165 private:
00167 ListEditorDelegate();
00169 ListEditor::Type type_;
00171 String restrictions_;
00173 QString typeName_;
00175 mutable QString file_name_;
00176
00177
00178 };
00179 }
00180
00181
00182
00183
00184
00185 }
00186 #endif //OPENMS_VISUAL_LISTEDITOR_H