pgLab/pglab/SequenceModel.h

48 lines
1.1 KiB
C++

#ifndef SEQUENCEMODEL_H
#define SEQUENCEMODEL_H
#include <QAbstractTableModel>
//#include "catalog/PgClass.h"
#include "catalog/PgSequence.h"
#include <memory>
class PgDatabaseCatalog;
class PgSequenceContainer;
class SequenceModel: public QAbstractTableModel {
Q_OBJECT
public:
enum e_Columns : int {
NameCol,
SchemaCol,
OwnerCol,
LastCol,
StartCol,
MinCol,
MaxCol,
IncrementCol,
CacheCol,
CycledCol,
CalledCol,
AclCol,
colCount
};
SequenceModel(QObject * parent = nullptr);
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
void setCatalog(std::shared_ptr<const PgDatabaseCatalog> cat);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role) const override;
PgSequence sequence(int row) const;
private:
std::shared_ptr<const PgDatabaseCatalog> m_catalog;
std::shared_ptr<const PgSequenceContainer> m_sequences;
};
#endif // SEQUENCEMODEL_H