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:
parent
a704332342
commit
42432b06a9
31 changed files with 598 additions and 472 deletions
42
pglab/widgets/CatalogConstraintPage.cpp
Normal file
42
pglab/widgets/CatalogConstraintPage.cpp
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#include "CatalogConstraintPage.h"
|
||||
#include "ConstraintModel.h"
|
||||
#include "CustomFilterSortModel.h"
|
||||
#include "IconColumnDelegate.h"
|
||||
#include "PgLabTableView.h"
|
||||
#include "SqlCodePreview.h"
|
||||
#include <QStringBuilder>
|
||||
|
||||
CatalogConstraintPage::CatalogConstraintPage(QWidget *parent)
|
||||
: CatalogPageBase(parent)
|
||||
{
|
||||
m_constraintModel = new ConstraintModel(this);
|
||||
m_sortFilterProxy->setSourceModel(m_constraintModel);
|
||||
|
||||
m_tableView->setItemDelegateForColumn(0, new IconColumnDelegate(this));
|
||||
|
||||
connect(m_tableView->selectionModel(), &QItemSelectionModel::selectionChanged,
|
||||
this, &CatalogConstraintPage::tableView_selectionChanged);
|
||||
}
|
||||
|
||||
void CatalogConstraintPage::catalogSet()
|
||||
{
|
||||
}
|
||||
|
||||
void CatalogConstraintPage::setFilter(const std::optional<PgClass> &cls)
|
||||
{
|
||||
m_constraintModel->setData(m_catalog, cls);
|
||||
m_tableView->resizeColumnsToContents();
|
||||
}
|
||||
|
||||
void CatalogConstraintPage::tableView_selectionChanged(const QItemSelection &/*selected*/, const QItemSelection &/*deselected*/)
|
||||
{
|
||||
auto rijen = selectedRows();
|
||||
QString drops;
|
||||
QString creates;
|
||||
for (auto rij : rijen) {
|
||||
const PgConstraint constraint = m_constraintModel->constraint(rij);
|
||||
drops += constraint.dropSql() % "\n";
|
||||
creates += constraint.createSql() % "\n";
|
||||
}
|
||||
m_definitionView->setPlainText(drops % "\n" % creates);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue