This commit is contained in:
eelke 2022-01-17 05:53:56 +01:00
parent 50bf4588ce
commit 93a55047b6
2 changed files with 0 additions and 72 deletions

View file

@ -40,8 +40,6 @@ void TablesTableModel::refresh()
// Later afscheiden naar filter functie
auto classes = m_catalog->classes();
// How many?
m_tables.clear();
for (const auto &e : *classes) {
bool add = false;
@ -62,63 +60,8 @@ void TablesTableModel::refresh()
if (add)
m_tables.push_back(e);
}
// doSort(1);
}
//void TablesTableModel::setSortOrder(int so)
//{
// beginResetModel();
// doSort(so);
// endResetModel();
//}
//namespace {
// inline bool compareByName(PgClass l, PgClass r)
// {
// return l.objectName() < r.objectName()
// || (l.objectName() == r.objectName() && l.nsName() < r.nsName());
// }
// inline bool compareBySchema(PgClass l, PgClass r)
// {
// return l.nsName() < r.nsName()
// || (l.nsName() == r.nsName() && l.objectName() < r.objectName());
// }
//}
//void TablesTableModel::sort(int column, Qt::SortOrder order)
//{
// if (column == NameCol) {
// if (order == Qt::AscendingOrder)
// std::sort(m_tables.begin(), m_tables.end(), compareByName);
// else
// std::sort(m_tables.begin(), m_tables.end(), [] (auto l, auto r) { return !compareByName(l, r); });
// }
// else if (column == NamespaceCol) {
// if (order == Qt::AscendingOrder)
// std::sort(m_tables.begin(), m_tables.end(), compareBySchema);
// else
// std::sort(m_tables.begin(), m_tables.end(), [] (auto l, auto r) { return !compareBySchema(l, r); });
// }
// emit layoutChanged();
//}
//void TablesTableModel::doSort(int )
//{
//// if (so == 1)
//// std::sort(m_tables.begin(), m_tables.end(),
//// [] (auto l, auto r) -> bool { return l.relnamespace_name < r.relnamespace_name
//// || (l.relnamespace_name == r.relnamespace_name && l.name < r.name); });
//// else
//// std::sort(m_tables.begin(), m_tables.end(),
//// [] (auto l, auto r) -> bool { return l.name < r.name; });
//}
QVariant TablesTableModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (orientation == Qt::Horizontal) {
@ -142,7 +85,6 @@ QVariant TablesTableModel::headerData(int section, Qt::Orientation orientation,
return QVariant();
}
// Basic functionality:
int TablesTableModel::rowCount(const QModelIndex &) const
{
return static_cast<int>(m_tables.size());
@ -208,13 +150,6 @@ Oid TablesTableModel::getTableOid(int row) const
return m_tables[row].oid();
}
//QString TablesTableModel::formatTableName(const PgClass &cls) const
//{
// const char * format = "%2 (%1)";
// QString ns_name = getNamespaceDisplayString(*m_catalog, cls.relnamespace);
// return QString(format).arg(ns_name).arg(cls.objectName());
//}
QVariant TablesTableModel::data(const QModelIndex &index, int role) const
{
if (role == Qt::DisplayRole)