diff --git a/pglab/TablesTableModel.cpp b/pglab/TablesTableModel.cpp index 9c30d27..1bca636 100644 --- a/pglab/TablesTableModel.cpp +++ b/pglab/TablesTableModel.cpp @@ -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(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) diff --git a/pglab/TablesTableModel.h b/pglab/TablesTableModel.h index f0c646b..b327b56 100644 --- a/pglab/TablesTableModel.h +++ b/pglab/TablesTableModel.h @@ -36,13 +36,8 @@ public: void setNamespaceFilter(NamespaceFilter nsf); void setCatalog(std::shared_ptr cat); -// virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override; -// void setSortOrder(int so); - - // Header: QVariant headerData(int section, Qt::Orientation orientation, int role) const override; - // Basic functionality: int rowCount(const QModelIndex &parent) const override; int columnCount(const QModelIndex &parent) const override; @@ -65,8 +60,6 @@ private: Oid getType(int column) const; QVariant getData(const QModelIndex &index) const; -// QString formatTableName(const PgClass &cls) const; -// void doSort(int so); private slots: void refresh();