Updating of detail tabs besides list of tables works correctly again.

Had stopped working because the catalog now behaves a little different,
returning nullptr instead of an invalid element.
This commit is contained in:
eelke 2018-11-18 20:24:27 +01:00
parent fcb191f2cc
commit 52011a9842
12 changed files with 114 additions and 92 deletions

View file

@ -5,15 +5,17 @@
#include "ScopeGuard.h"
#include "CustomDataRole.h"
void IndexModel::setData(std::shared_ptr<const PgDatabaseCatalog> cat, const PgClass &table)
void IndexModel::setData(std::shared_ptr<const PgDatabaseCatalog> cat, const std::optional<PgClass> &table)
{
beginResetModel();
SCOPE_EXIT { endResetModel(); };
m_catalog = cat;
m_table = table;
m_indexes = cat->indexes()->getIndexesForTable(table.oid);
if (table)
m_indexes = cat->indexes()->getIndexesForTable(table->oid);
else
m_indexes.clear();
}
int IndexModel::rowCount(const QModelIndex &/*parent*/) const