MorphoGraphX
ProcessParms.hpp
1 //
2 // This file is part of MorphoGraphX - http://www.MorphoGraphX.org
3 // Copyright (C) 2012-2015 Richard S. Smith and collaborators.
4 //
5 // If you use MorphoGraphX in your work, please cite:
6 // http://dx.doi.org/10.7554/eLife.05864
7 //
8 // MorphoGraphX is free software, and is licensed under under the terms of the
9 // GNU General (GPL) Public License version 2.0, http://www.gnu.org/licenses.
10 //
11 #ifndef PROCESSPARMS_HPP
12 #define PROCESSPARMS_HPP
13 
14 #include <Process.hpp>
15 
16 #include <QAbstractTableModel>
17 #include <QStyledItemDelegate>
18 
20  Q_OBJECT
21 public:
22  FreeFloatDelegate(QObject* parent = 0);
23  QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const;
24  void setEditorData(QWidget* editor, const QModelIndex& index) const;
25  void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const;
26  void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const;
27 };
28 
30  Q_OBJECT
31 public:
32  ProcessParmsModel(QObject* parent = 0)
33  : QAbstractTableModel(parent)
34  {
35  }
36  void setParms(const mgx::process::BaseProcessDefinition& def);
37  void setParms(const QStringList& parms);
38  void clear();
39 
40  int rowCount(const QModelIndex& /*parent*/ = QModelIndex()) const {
41  return names.size();
42  }
43  int columnCount(const QModelIndex& /*parent*/ = QModelIndex()) const {
44  return 2;
45  }
46  QVariant data(const QModelIndex& index, int role) const;
47  QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
48  Qt::ItemFlags flags(const QModelIndex& index) const;
49  bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
50  const QStringList& parms() const {
51  return _parms;
52  }
53 
54  QStringList parmChoice(int pos) const;
55 
56 signals:
57  void valuesChanged();
58 
59 protected:
60  QStringList names;
61  QStringList descs;
62  QStringList _parms;
63  mgx::process::ParmChoiceMap _parmChoice;
64 };
65 #endif
Definition of a process, without the process factory.
Definition: Process.hpp:1239
Definition: ProcessParms.hpp:29
File containing the definition of a Process.
Definition: ProcessParms.hpp:19