CatalogueEventsTableModel.h
40 lines
| 1.5 KiB
| text/x-c
|
CLexer
r1130 | #ifndef SCIQLOP_CATALOGUEEVENTSTABLEMODEL_H | |||
#define SCIQLOP_CATALOGUEEVENTSTABLEMODEL_H | ||||
#include <Common/spimpl.h> | ||||
#include <QAbstractTableModel> | ||||
r1143 | class DBEvent; | |||
r1130 | ||||
class CatalogueEventsTableModel : public QAbstractTableModel { | ||||
public: | ||||
CatalogueEventsTableModel(QObject *parent = nullptr); | ||||
r1143 | void setEvents(const QVector<std::shared_ptr<DBEvent> > &events); | |||
std::shared_ptr<DBEvent> getEvent(int row) const; | ||||
r1130 | ||||
r1148 | void addEvent(const std::shared_ptr<DBEvent> &event); | |||
void removeEvent(const std::shared_ptr<DBEvent> &event); | ||||
void refreshEvent(const std::shared_ptr<DBEvent> &event); | ||||
r1130 | ||||
// Model | ||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override; | ||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override; | ||||
Qt::ItemFlags flags(const QModelIndex &index) const override; | ||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; | ||||
QVariant headerData(int section, Qt::Orientation orientation, | ||||
int role = Qt::DisplayRole) const override; | ||||
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override; | ||||
r1133 | Qt::DropActions supportedDragActions() const override; | |||
QStringList mimeTypes() const override; | ||||
QMimeData *mimeData(const QModelIndexList &indexes) const override; | ||||
r1130 | ||||
private: | ||||
class CatalogueEventsTableModelPrivate; | ||||
spimpl::unique_impl_ptr<CatalogueEventsTableModelPrivate> impl; | ||||
}; | ||||
#endif // SCIQLOP_CATALOGUEEVENTSTABLEMODEL_H | ||||