43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
#ifndef DATABASESTABLEMODEL_H
|
|
#define DATABASESTABLEMODEL_H
|
|
|
|
#include "BaseTableModel.h"
|
|
#include <memory>
|
|
|
|
class PgDatabaseContainer;
|
|
class PgDatabaseCatalogue;
|
|
|
|
/** Class for displaying the list of databases of a server in a QTableView
|
|
*
|
|
*/
|
|
class DatabasesTableModel : public BaseTableModel
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
enum e_Columns : int { NameCol, DbaCol, EncodingCol, CollateCol,
|
|
CTypeCol, IsTemplateCol, AllowConnCol, ConnLimitCol,
|
|
TablespaceCol, AclCol, COL_COUNT };
|
|
|
|
|
|
|
|
explicit DatabasesTableModel(QObject *parent);
|
|
|
|
void setDatabaseList(std::shared_ptr<const PgDatabaseCatalogue> cat);
|
|
|
|
// 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;
|
|
|
|
virtual Oid getType(int column) const override;
|
|
virtual QVariant getData(const QModelIndex &index) const override;
|
|
|
|
private:
|
|
std::shared_ptr<const PgDatabaseCatalogue> m_catalog;
|
|
std::shared_ptr<const PgDatabaseContainer> m_databases;
|
|
};
|
|
|
|
#endif // DATABASESTABLEMODEL_H
|