2022-04-09 07:10:29 +02:00
|
|
|
|
#include "catalog/widgets/CatalogPageBase.h"
|
2019-02-09 09:49:27 +01:00
|
|
|
|
#include "CustomFilterSortModel.h"
|
2022-04-09 07:10:29 +02:00
|
|
|
|
#include "util/PgLabTableView.h"
|
2019-02-09 09:49:27 +01:00
|
|
|
|
#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;
|
|
|
|
|
|
}
|