- 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
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
#include "TriggerPage.h"
|
|
#include "ResultTableModelUtil.h"
|
|
#include "UserConfiguration.h"
|
|
#include "catalog/PgClass.h"
|
|
#include "SqlCodePreview.h"
|
|
#include "TriggerTableModel.h"
|
|
#include "CustomFilterSortModel.h"
|
|
#include "CustomDataRole.h"
|
|
#include "PgLabTableView.h"
|
|
#include <QStringBuilder>
|
|
#include <unordered_set>
|
|
|
|
TriggerPage::TriggerPage(QWidget *parent)
|
|
: CatalogPageBase(parent)
|
|
{
|
|
m_model = new TriggerTableModel(this);
|
|
m_sortFilterProxy->setSourceModel(m_model);
|
|
|
|
connect(m_tableView->selectionModel(), &QItemSelectionModel::selectionChanged,
|
|
this, &TriggerPage::tableView_selectionChanged);
|
|
}
|
|
|
|
|
|
void TriggerPage::catalogSet()
|
|
{
|
|
m_model->setCatalog(m_catalog);
|
|
}
|
|
|
|
|
|
void TriggerPage::setFilter(const std::optional<PgClass> &cls)
|
|
{
|
|
m_sortFilterProxy->setOidFilterTable(cls ? cls->oid() : InvalidOid, FirstHiddenValue);
|
|
m_tableView->resizeColumnsToContents();
|
|
}
|
|
|
|
|
|
void TriggerPage::tableView_selectionChanged(const QItemSelection &/*selected*/, const QItemSelection &/*deselected*/)
|
|
{
|
|
auto rijen = selectedRows();
|
|
|
|
QString drops;
|
|
QString creates;
|
|
for (auto rij : rijen) {
|
|
auto&& t = m_model->trigger(rij);
|
|
drops += t.dropSql() % "\n";
|
|
creates += t.createSql() % "\n";
|
|
}
|
|
m_definitionView->setPlainText(drops % "\n" % creates);
|
|
}
|