45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#include "TablesPage.h"
|
|
#include "ui_TablesPage.h"
|
|
|
|
#include "PgAttribute.h"
|
|
#include "TablesTableModel.h"
|
|
#include "ResultTableModelUtil.h"
|
|
#include "ColumnTableModel.h"
|
|
|
|
TablesPage::TablesPage(QWidget *parent) :
|
|
QWidget(parent),
|
|
ui(new Ui::TablesPage)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
SetTableViewDefault(ui->tableListTable);
|
|
m_tablesModel = new TablesTableModel(this);
|
|
ui->tableListTable->setModel(m_tablesModel);
|
|
|
|
SetTableViewDefault(ui->columnsTable);
|
|
m_columnsModel = new ColumnTableModel(this);
|
|
ui->columnsTable->setModel(m_columnsModel);
|
|
|
|
connect(ui->tableListTable->selectionModel(), &QItemSelectionModel::currentRowChanged, this,
|
|
&TablesPage::on_tableListTable_currentRowChanged);
|
|
|
|
}
|
|
|
|
TablesPage::~TablesPage()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void TablesPage::setCatalog(std::shared_ptr<PgDatabaseCatalog> cat)
|
|
{
|
|
m_catalog = cat;
|
|
m_tablesModel->setCatalog(cat);
|
|
}
|
|
|
|
void TablesPage::on_tableListTable_currentRowChanged(const QModelIndex ¤t, const QModelIndex &previous)
|
|
{
|
|
if (current.row() != previous.row()) {
|
|
Oid table_oid = m_tablesModel->getTableOid(current.row());
|
|
m_columnsModel->setData(m_catalog, table_oid);
|
|
}
|
|
}
|