Reorganization of pgLab project

This commit is contained in:
eelke 2022-04-09 07:10:29 +02:00
parent 7300865c77
commit c71fdc4af7
78 changed files with 204 additions and 148 deletions

View file

@ -1,46 +0,0 @@
#include "CatalogIndexPage.h"
#include "CustomFilterSortModel.h"
#include "IndexModel.h"
#include "PgLabTableView.h"
#include "SqlCodePreview.h"
#include <QHeaderView>
#include <QStringBuilder>
#include "IconColumnDelegate.h"
CatalogIndexPage::CatalogIndexPage(QWidget *parent)
: CatalogPageBase(parent)
{
m_indexModel = new IndexModel(this);
m_sortFilterProxy->setSourceModel(m_indexModel);
m_tableView->setItemDelegateForColumn(0, new IconColumnDelegate(this));
m_tableView->horizontalHeader()->setSortIndicator(IndexModel::NameCol, Qt::AscendingOrder);
m_tableView->setSortingEnabled(true);
connect(m_tableView->selectionModel(), &QItemSelectionModel::selectionChanged,
this, &CatalogIndexPage::tableView_selectionChanged);
connect(m_indexModel, &IndexModel::modelReset, m_definitionView, &SqlCodePreview::clear);
}
void CatalogIndexPage::catalogSet()
{
}
void CatalogIndexPage::setFilter(const std::optional<PgClass> &cls)
{
m_indexModel->setData(m_catalog, cls);
m_tableView->resizeColumnsToContents();
}
void CatalogIndexPage::tableView_selectionChanged(const QItemSelection &/*selected*/, const QItemSelection &/*deselected*/)
{
auto rijen = selectedRows();
QString drops;
QString creates;
for (auto rij : rijen) {
const PgIndex index = m_indexModel->getIndex(rij);
drops += index.dropSql() % "\n";
creates += index.createSql() % "\n";
}
m_definitionView->setPlainText(drops % "\n" % creates);
}