From 7ca671a078bc76788cdd278b035de1f7ff995ba0 Mon Sep 17 00:00:00 2001 From: eelke Date: Sat, 9 Feb 2019 17:44:05 +0100 Subject: [PATCH] Fix: when looking up data reverse mapping of proxy filter so we select correct data. --- pglab/widgets/CatalogTablesPage.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pglab/widgets/CatalogTablesPage.cpp b/pglab/widgets/CatalogTablesPage.cpp index 1d0aaaa..75d840f 100644 --- a/pglab/widgets/CatalogTablesPage.cpp +++ b/pglab/widgets/CatalogTablesPage.cpp @@ -110,7 +110,8 @@ void CatalogTablesPage::tableListTable_currentRowChanged(const QModelIndex &curr { if (current.row() != previous.row()) { if (current.isValid()) { - PgClass table = m_tablesModel->getTable(current.row()); + auto row = m_tablesSortFilter->mapToSource(current).row(); + PgClass table = m_tablesModel->getTable(row); selectedTableChanged(table); } else @@ -123,7 +124,8 @@ void CatalogTablesPage::tableListTable_layoutChanged(const QListselectionModel()->currentIndex(); if (index.isValid()) { - PgClass table = m_tablesModel->getTable(index.row()); + auto row = m_tablesSortFilter->mapToSource(index).row(); + PgClass table = m_tablesModel->getTable(row); selectedTableChanged(table); } else @@ -132,7 +134,9 @@ void CatalogTablesPage::tableListTable_layoutChanged(const QListgetTable(index.row()); + + 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() }