Fix: when looking up data reverse mapping of proxy filter so we select correct

data.
This commit is contained in:
eelke 2019-02-09 17:44:05 +01:00
parent b08bd1a315
commit 7ca671a078

View file

@ -110,7 +110,8 @@ void CatalogTablesPage::tableListTable_currentRowChanged(const QModelIndex &curr
{ {
if (current.row() != previous.row()) { if (current.row() != previous.row()) {
if (current.isValid()) { 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); selectedTableChanged(table);
} }
else else
@ -123,7 +124,8 @@ void CatalogTablesPage::tableListTable_layoutChanged(const QList<QPersistentMode
{ {
auto&& index = m_tableView->selectionModel()->currentIndex(); auto&& index = m_tableView->selectionModel()->currentIndex();
if (index.isValid()) { 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); selectedTableChanged(table);
} }
else else
@ -132,7 +134,9 @@ void CatalogTablesPage::tableListTable_layoutChanged(const QList<QPersistentMode
void CatalogTablesPage::on_tableListTable_doubleClicked(const QModelIndex &index) void CatalogTablesPage::on_tableListTable_doubleClicked(const QModelIndex &index)
{ {
PgClass table = m_tablesModel->getTable(index.row());
auto row = m_tablesSortFilter->mapToSource(index).row();
PgClass table = m_tablesModel->getTable(row);
if (table.oid() != InvalidOid) { if (table.oid() != InvalidOid) {
// context()->moduleAction("pglab.crudpage", "open", { // context()->moduleAction("pglab.crudpage", "open", {
// { "oid", table.oid() } // { "oid", table.oid() }