45 lines
1 KiB
C
45 lines
1 KiB
C
|
|
#ifndef COLUMNTABLEMODEL_H
|
|||
|
|
#define COLUMNTABLEMODEL_H
|
|||
|
|
|
|||
|
|
#include "BaseTableModel.h"
|
|||
|
|
#include <memory>
|
|||
|
|
|
|||
|
|
class PgDatabaseCatalog;
|
|||
|
|
class PgAttribute;
|
|||
|
|
|
|||
|
|
class ColumnTableModel: public BaseTableModel {
|
|||
|
|
public:
|
|||
|
|
enum e_Columns : int {
|
|||
|
|
NameCol, ///
|
|||
|
|
TypeCol,
|
|||
|
|
NullCol,
|
|||
|
|
DefaultCol,
|
|||
|
|
CollationCol,
|
|||
|
|
|
|||
|
|
colCount };
|
|||
|
|
|
|||
|
|
|
|||
|
|
using BaseTableModel::BaseTableModel;
|
|||
|
|
void setData(std::shared_ptr<const PgDatabaseCatalog> cat, Oid table_oid);
|
|||
|
|
|
|||
|
|
// Header:
|
|||
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
|||
|
|
|
|||
|
|
// Basic functionality:
|
|||
|
|
int rowCount(const QModelIndex &parent) const override;
|
|||
|
|
int columnCount(const QModelIndex &parent) const override;
|
|||
|
|
|
|||
|
|
QVariant data(const QModelIndex &index, int role) const override;
|
|||
|
|
protected:
|
|||
|
|
virtual Oid getType(int column) const override;
|
|||
|
|
virtual QVariant getData(const QModelIndex &index) const override;
|
|||
|
|
|
|||
|
|
using t_Columns = std::vector<PgAttribute>;
|
|||
|
|
|
|||
|
|
std::shared_ptr<const PgDatabaseCatalog> m_catalog;
|
|||
|
|
t_Columns m_columns;
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
#endif // COLUMNTABLEMODEL_H
|