For testing purposes a new table tab is created when a querytab is created.
This commit is contained in:
parent
6466062cc8
commit
f9caadb59e
5 changed files with 33 additions and 4 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#include "MainWindow.h"
|
||||
#include "ui_MainWindow.h"
|
||||
#include "TablesPage.h"
|
||||
|
||||
#include <QStandardPaths>
|
||||
#include <QFileDialog>
|
||||
|
|
@ -39,9 +40,17 @@ QueryTab* MainWindow::newSqlPage()
|
|||
ui->tabWidget->addTab(qt, "Tab");
|
||||
ui->tabWidget->setCurrentWidget(qt);
|
||||
qt->newdoc();
|
||||
|
||||
auto tt = new TablesPage(this);
|
||||
tt->setCatalog(m_database->catalogue());
|
||||
ui->tabWidget->addTab(tt, "Tables");
|
||||
ui->tabWidget->setCurrentWidget(tt);
|
||||
|
||||
return qt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
QueryTab *MainWindow::GetActiveQueryTab()
|
||||
{
|
||||
QWidget *widget = ui->tabWidget->currentWidget();
|
||||
|
|
@ -213,7 +222,7 @@ void MainWindow::showEvent(QShowEvent *event)
|
|||
|
||||
void MainWindow::on_actionNew_SQL_triggered()
|
||||
{
|
||||
newSqlPage()->newdoc();
|
||||
newSqlPage();
|
||||
}
|
||||
|
||||
void MainWindow::on_tabWidget_tabCloseRequested(int index)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ std::string PgClassContainer::getLoadQuery() const
|
|||
return "SELECT oid, relname, relnamespace, reltype, reloftype, "
|
||||
" relowner, relam, relfilenode, reltablespace, relpages, "
|
||||
" reltuples, reltoastrelid, relisshared, relpersistence, "
|
||||
" relkind, relhasoids, relispopulated, relfrozenxid, relrelminmxid "
|
||||
" relkind, relhasoids, relispopulated, relfrozenxid, relminmxid "
|
||||
" relacl, reloptions \n"
|
||||
"FROM pg_catalog.pg_class";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ PgDatabaseCatalog::~PgDatabaseCatalog()
|
|||
|
||||
void PgDatabaseCatalog::loadAll(Pgsql::Connection &conn)
|
||||
{
|
||||
loadInfo(conn);
|
||||
loadTypes(conn);
|
||||
loadDatabases(conn);
|
||||
loadAuthIds(conn);
|
||||
|
|
|
|||
|
|
@ -1,11 +1,23 @@
|
|||
#include "TablesPage.h"
|
||||
#include "TablesPage.h"
|
||||
#include "ui_TablesPage.h"
|
||||
|
||||
#include "TablesTableModel.h"
|
||||
|
||||
TablesPage::TablesPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::TablesPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_tablesModel = new TablesTableModel(this);
|
||||
ui->tableListTable->setModel(m_tablesModel);
|
||||
|
||||
}
|
||||
|
||||
void TablesPage::setCatalog(std::shared_ptr<PgDatabaseCatalog> cat)
|
||||
{
|
||||
m_catalog = cat;
|
||||
m_tablesModel->setCatalog(cat);
|
||||
}
|
||||
|
||||
TablesPage::~TablesPage()
|
||||
|
|
|
|||
|
|
@ -1,12 +1,16 @@
|
|||
#ifndef TABLESPAGE_H
|
||||
#ifndef TABLESPAGE_H
|
||||
#define TABLESPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <memory>
|
||||
|
||||
namespace Ui {
|
||||
class TablesPage;
|
||||
}
|
||||
|
||||
class TablesTableModel;
|
||||
class PgDatabaseCatalog;
|
||||
|
||||
class TablesPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
@ -15,8 +19,11 @@ public:
|
|||
explicit TablesPage(QWidget *parent = 0);
|
||||
~TablesPage();
|
||||
|
||||
void setCatalog(std::shared_ptr<PgDatabaseCatalog> cat);
|
||||
private:
|
||||
Ui::TablesPage *ui;
|
||||
std::shared_ptr<PgDatabaseCatalog> m_catalog;
|
||||
TablesTableModel* m_tablesModel = nullptr;
|
||||
};
|
||||
|
||||
#endif // TABLESPAGE_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue