Reorganization of pgLab project
This commit is contained in:
parent
7300865c77
commit
c71fdc4af7
78 changed files with 204 additions and 148 deletions
68
pglab/catalog/models/IndexModel.h
Normal file
68
pglab/catalog/models/IndexModel.h
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
#ifndef INDEXMODEL_H
|
||||
#define INDEXMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include "catalog/PgClass.h"
|
||||
#include "catalog/PgIndex.h"
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class PgDatabaseCatalog;
|
||||
|
||||
class IndexModel: public QAbstractTableModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
using QAbstractTableModel::QAbstractTableModel;
|
||||
|
||||
enum e_Columns : int {
|
||||
TypeCol, /// primary/unique/normal
|
||||
NameCol, ///
|
||||
AmCol, ///< Access Method
|
||||
ColumnsCol, ///
|
||||
ConditionCol,
|
||||
SizeCol,
|
||||
ExplicitIndexCol,
|
||||
colCount };
|
||||
|
||||
// oid
|
||||
// tablespace
|
||||
// operator class
|
||||
// unique
|
||||
// primary
|
||||
// clustered
|
||||
// valid
|
||||
// constraint
|
||||
// system index
|
||||
// fill factor
|
||||
// comment
|
||||
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
void setData(std::shared_ptr<const PgDatabaseCatalog> cat, const std::optional<PgClass> &table);
|
||||
|
||||
|
||||
// Basic functionality:
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
virtual QVariant data(const QModelIndex &index, int role) const override;
|
||||
|
||||
PgIndex getIndex(int row) const { return m_indexes[row]; }
|
||||
protected:
|
||||
Oid getType(int column) const;
|
||||
QVariant getData(const QModelIndex &index) const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<const PgDatabaseCatalog> m_catalog;
|
||||
std::optional<PgClass> m_table;
|
||||
|
||||
using t_Indexes = std::vector<PgIndex>;
|
||||
t_Indexes m_indexes;
|
||||
QMetaObject::Connection refreshConnection;
|
||||
|
||||
private slots:
|
||||
void refresh();
|
||||
};
|
||||
|
||||
#endif // INDEXMODEL_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue