Tables are now sorted by not perfect yet.
This commit is contained in:
parent
ec78dafa94
commit
a79357db87
2 changed files with 19 additions and 0 deletions
|
|
@ -34,9 +34,25 @@ void TablesTableModel::setCatalog(std::shared_ptr<const PgDatabaseCatalog> cat)
|
|||
}
|
||||
}
|
||||
|
||||
doSort(1);
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void TablesTableModel::setSortOrder(int so)
|
||||
{
|
||||
beginResetModel();
|
||||
doSort(so);
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void TablesTableModel::doSort(int so)
|
||||
{
|
||||
if (so == 1)
|
||||
std::sort(m_tables.begin(), m_tables.end(),
|
||||
[] (auto l, auto r) -> bool { return l.relnamespace < r.relnamespace
|
||||
|| (l.relnamespace == r.relnamespace && l.name < r.name); });
|
||||
}
|
||||
|
||||
|
||||
QVariant TablesTableModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue