Added list of constraints to the tables page.
Last column shows the full textual definition until I have decided on a better way to visualize the details.
This commit is contained in:
parent
22db22c6b1
commit
a99f059b70
27 changed files with 663 additions and 22 deletions
51
pglab/ConstraintModel.h
Normal file
51
pglab/ConstraintModel.h
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#ifndef CONSTRAINTMODEL_H
|
||||
#define CONSTRAINTMODEL_H
|
||||
|
||||
#include "BaseTableModel.h"
|
||||
#include "PgClass.h"
|
||||
#include "PgConstraint.h"
|
||||
#include <QAbstractTableModel>
|
||||
#include <vector>
|
||||
|
||||
class PgDatabaseCatalog;
|
||||
|
||||
class ConstraintModel : public BaseTableModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
enum e_Columns : int {
|
||||
TypeCol,
|
||||
NameCol, ///
|
||||
NsCol, ///
|
||||
SupportingIndexCol,
|
||||
DefinitionCol,
|
||||
colCount };
|
||||
|
||||
explicit ConstraintModel(QObject *parent = nullptr);
|
||||
|
||||
void setData(std::shared_ptr<const PgDatabaseCatalog> cat, const PgClass &table);
|
||||
|
||||
|
||||
// Header:
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
|
||||
// Basic functionality:
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
//QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
protected:
|
||||
|
||||
virtual Oid getType(int column) const override;
|
||||
virtual QVariant getData(const QModelIndex &index) const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<const PgDatabaseCatalog> m_catalog;
|
||||
PgClass m_table;
|
||||
|
||||
using t_Constraints = std::vector<PgConstraint>;
|
||||
t_Constraints m_constraints;
|
||||
};
|
||||
|
||||
#endif // CONSTRAINTMODEL_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue