2016-10-26 04:41:42 +00:00
|
|
|
#ifndef ENTRYPOINTMODEL_H
|
|
|
|
#define ENTRYPOINTMODEL_H
|
|
|
|
|
2016-10-26 07:23:33 +00:00
|
|
|
#include "EntryPoints.h"
|
|
|
|
|
|
|
|
#include <QDataStream>
|
2016-10-26 04:41:42 +00:00
|
|
|
#include <QAbstractTableModel>
|
|
|
|
|
2016-10-26 07:23:33 +00:00
|
|
|
|
|
|
|
|
2016-10-26 04:41:42 +00:00
|
|
|
|
|
|
|
class EntryPointModel : public QAbstractTableModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2016-10-26 07:23:33 +00:00
|
|
|
explicit EntryPointModel(QObject *parent = 0, EntryPoints *points = Q_NULLPTR);
|
|
|
|
void setEntryPointsData(EntryPoints *points);
|
2016-10-26 04:41:42 +00:00
|
|
|
|
|
|
|
// Header:
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;//DONE
|
|
|
|
|
|
|
|
// Basic functionality:
|
2016-10-26 07:23:33 +00:00
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
2016-10-26 04:41:42 +00:00
|
|
|
|
2016-10-26 07:23:33 +00:00
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
2016-10-26 04:41:42 +00:00
|
|
|
|
|
|
|
// Editable:
|
|
|
|
bool setData(const QModelIndex &index, const QVariant &value,
|
|
|
|
int role = Qt::EditRole) override;
|
|
|
|
|
|
|
|
Qt::ItemFlags flags(const QModelIndex& index) const override;
|
|
|
|
|
|
|
|
// Add data:
|
|
|
|
bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
|
|
|
|
|
|
|
// Remove data:
|
|
|
|
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
|
|
|
|
|
|
|
void doTestData();
|
|
|
|
|
|
|
|
|
2016-10-26 07:23:33 +00:00
|
|
|
protected slots:
|
|
|
|
void handlePointAddition(int location) { insertRows(location,1); }
|
|
|
|
void handlePointRemoval(int location) { removeRows(location, 1); }
|
|
|
|
void handlePointChange(int location)
|
|
|
|
{
|
|
|
|
QModelIndex ind = createIndex(location,0);
|
|
|
|
emit dataChanged(ind,ind,QVector<int>() << Qt::DisplayRole);
|
|
|
|
}
|
2016-10-26 04:41:42 +00:00
|
|
|
|
|
|
|
|
2016-10-26 07:23:33 +00:00
|
|
|
private:
|
|
|
|
EntryPoints *entryPoints;
|
2016-10-26 04:41:42 +00:00
|
|
|
};
|
|
|
|
|
2016-10-26 07:23:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-26 04:41:42 +00:00
|
|
|
#endif // ENTRYPOINTMODEL_H
|