Debian Codegraph @

avogadro/qtplugins/constraints/constraintsmodel.h

raw
1 /******************************************************************************
2 This source file is part of the Avogadro project.
3 This source code is released under the 3-Clause BSD License, (see "LICENSE").
4 ******************************************************************************/
5
6 #ifndef CONSTRAINTSMODEL_H
7 #define CONSTRAINTSMODEL_H
8
9 #include <QtCore/QObject>
10 #include <QtCore/QList>
11 #include <QtCore/QString>
12 #include <QtCore/QAbstractTableModel>
13
14 #include <avogadro/qtgui/molecule.h>
15 #include <avogadro/core/constraint.h>
16
17 namespace Avogadro {
18 namespace QtPlugins {
19
20 class ConstraintsModel : public QAbstractTableModel
21
22 {
23 Q_OBJECT
24
25 public:
26 ConstraintsModel() : QAbstractTableModel() {}
27
28 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
29 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
30 QVariant data(const QModelIndex& index, int role) const override;
31 QVariant headerData(int section, Qt::Orientation orientation,
32 int role = Qt::DisplayRole) const override;
33
34 void clear();
35 Core::Constraint constraint(int index);
36 std::vector<Core::Constraint> constraints() { return m_constraints; }
37 void addConstraint(int type, int a, int b, int c, int d, double value);
38 void deleteConstraint(int index);
39 void setConstraints(const std::vector<Core::Constraint>& constraints);
40 int currentRow = -1;
41
42 public slots:
43 void emitDataChanged();
44
45 private:
46 std::vector<Core::Constraint> m_constraints;
47
48 }; // ConstraintsModel
49
50 } // namespace QtPlugins
51 } // end namespace Avogadro
52
53 #endif