| 1 |
/****************************************************************************** |
| 2 |
|
| 3 |
This source file is part of the Avogadro project. |
| 4 |
|
| 5 |
Copyright 2015 Marcus Johansson <[email protected]> |
| 6 |
|
| 7 |
This source code is released under the New BSD License, (the "License"). |
| 8 |
|
| 9 |
Unless required by applicable law or agreed to in writing, software |
| 10 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
See the License for the specific language governing permissions and |
| 13 |
limitations under the License. |
| 14 |
|
| 15 |
******************************************************************************/ |
| 16 |
|
| 17 |
#ifndef AVOGADRO_QTPLUGINS_OPERATIONSTABLEMODEL_H |
| 18 |
#define AVOGADRO_QTPLUGINS_OPERATIONSTABLEMODEL_H |
| 19 |
|
| 20 |
namespace msym { |
| 21 |
extern "C" |
| 22 |
{ |
| 23 |
#include <libmsym/msym.h> |
| 24 |
} |
| 25 |
} // namespace msym |
| 26 |
|
| 27 |
#include <QAbstractTableModel> |
| 28 |
#include <QStyledItemDelegate> |
| 29 |
#include <QTextDocument> |
| 30 |
|
| 31 |
#define OPERATIONSTABLEMODEL_COLUMN_COUNT 3 |
| 32 |
|
| 33 |
namespace Avogadro { |
| 34 |
namespace QtPlugins { |
| 35 |
|
| 36 |
class OperationsTableModel : public QAbstractTableModel |
| 37 |
{ |
| 38 |
Q_OBJECT |
| 39 |
|
| 40 |
public: |
| 41 |
enum Column |
| 42 |
{ |
| 43 |
ColumnType = 0, |
| 44 |
ColumnClass = 1, |
| 45 |
ColumnVector = 2 |
| 46 |
}; |
| 47 |
|
| 48 |
explicit OperationsTableModel(QObject* parent = nullptr); |
| 49 |
~OperationsTableModel() override; |
| 50 |
|
| 51 |
int rowCount(const QModelIndex&) const override { return m_operations_size; }; |
| 52 |
int columnCount(const QModelIndex&) const override |
| 53 |
{ |
| 54 |
return OPERATIONSTABLEMODEL_COLUMN_COUNT; |
| 55 |
}; |
| 56 |
|
| 57 |
QVariant data(const QModelIndex& index, |
| 58 |
int role = Qt::DisplayRole) const override; |
| 59 |
QVariant headerData(int section, Qt::Orientation orientation, |
| 60 |
int role) const override; |
| 61 |
|
| 62 |
void setOperations(int operations_size, |
| 63 |
const msym::msym_symmetry_operation_t* operations); |
| 64 |
void clearOperations(); |
| 65 |
|
| 66 |
private: |
| 67 |
const msym::msym_symmetry_operation_t* m_operations; |
| 68 |
int m_operations_size; |
| 69 |
}; |
| 70 |
} // namespace QtPlugins |
| 71 |
} // namespace Avogadro |
| 72 |
#endif // AVOGADRO_QTPLUGINS_OPERATIONSTABLEMODEL_H |