Make double clicking on table in CatalogInspector open crud for selected table/view.

This commit is contained in:
eelke 2019-08-16 10:49:38 +02:00
parent 1a2ec6a224
commit 6fdf631fac
8 changed files with 53 additions and 47 deletions

View file

@ -75,6 +75,9 @@ CatalogTablesPage::CatalogTablesPage(QWidget *parent)
connect(m_tablesModel, &QAbstractItemModel::layoutChanged,
this, &CatalogTablesPage::tableListTable_layoutChanged);
connect(m_tableView, &QTableView::doubleClicked,
this, &CatalogTablesPage::on_tableListTable_doubleClicked);
}
void CatalogTablesPage::retranslateUi(bool /*all*/)
@ -136,13 +139,10 @@ void CatalogTablesPage::tableListTable_layoutChanged(const QList<QPersistentMode
void CatalogTablesPage::on_tableListTable_doubleClicked(const QModelIndex &index)
{
auto row = m_tablesSortFilter->mapToSource(index).row();
PgClass table = m_tablesModel->getTable(row);
if (table.oid() != InvalidOid) {
// context()->moduleAction("pglab.crudpage", "open", {
// { "oid", table.oid() }
// });
tableSelected(table.oid());
}
}

View file

@ -6,6 +6,7 @@
#include <memory>
#include <optional>
#include <QAbstractItemModel>
#include "Pgsql_oids.h"
class CatalogConstraintPage;
class CatalogIndexPage;
@ -32,6 +33,9 @@ public:
void setNamespaceFilter(NamespaceFilter filter);
void retranslateUi(bool all = true);
signals:
void tableSelected(Oid tableoid);
private:
PgLabTableView *m_tableView = nullptr;
TablesTableModel* m_tablesModel = nullptr;