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
This commit is contained in:
eelke 2019-02-09 09:49:27 +01:00
parent a704332342
commit 42432b06a9
31 changed files with 598 additions and 472 deletions

View file

@ -0,0 +1,43 @@
#include "CatalogIndexPage.h"
#include "CustomFilterSortModel.h"
#include "IndexModel.h"
#include "PgLabTableView.h"
#include "SqlCodePreview.h"
#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));
connect(m_tableView->selectionModel(), &QItemSelectionModel::selectionChanged,
this, &CatalogIndexPage::tableView_selectionChanged);
}
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);
}