pgLab/pglab/widgets/CatalogPageBase.cpp
eelke 42432b06a9 Restructuring catalog tabs
- Moved detail tabs of table to their own components
- Table list has become seperate component on seperate tab
- Table list does not use designer anymore
- Moved sequences and functions tabs into the catalog inspector
2019-02-09 11:36:22 +01:00

35 lines
989 B
C++

#include "CatalogPageBase.h"
#include "CustomFilterSortModel.h"
#include "PgLabTableView.h"
#include "SqlCodePreview.h"
CatalogPageBase::CatalogPageBase(QWidget *parent)
: QSplitter(Qt::Vertical, parent)
{
m_tableView = new PgLabTableView(this);
m_definitionView = new SqlCodePreview(this);
addWidget(m_tableView);
addWidget(m_definitionView);
m_sortFilterProxy = new CustomFilterSortModel(this);
m_tableView->setModel(m_sortFilterProxy);
m_tableView->setSortingEnabled(true);
m_tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
}
void CatalogPageBase::setCatalog(std::shared_ptr<const PgDatabaseCatalog> cat)
{
m_catalog = cat;
m_definitionView->setCatalog(m_catalog);
catalogSet();
}
std::unordered_set<int> CatalogPageBase::selectedRows() const
{
auto&& indexes = m_tableView->selectionModel()->selectedIndexes();
std::unordered_set<int> rijen;
for (const auto &e : indexes)
rijen.insert(m_sortFilterProxy->mapToSource(e).row());
return rijen;
}