Cleanup
This commit is contained in:
parent
50bf4588ce
commit
93a55047b6
2 changed files with 0 additions and 72 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -36,13 +36,8 @@ public:
|
|||
void setNamespaceFilter(NamespaceFilter nsf);
|
||||
void setCatalog(std::shared_ptr<const PgDatabaseCatalog> 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();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue