Trigger page now reacts to catalog refreshed.
This commit is contained in:
parent
211d937c16
commit
f4f514efb0
3 changed files with 20 additions and 6 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#include "catalog/PgDatabaseCatalog.h"
|
||||
#include "catalog/PgTriggerContainer.h"
|
||||
#include "CustomDataRole.h"
|
||||
#include "ScopeGuard.h"
|
||||
|
||||
TriggerTableModel::TriggerTableModel(QObject *parent)
|
||||
: QAbstractTableModel(parent)
|
||||
|
|
@ -30,12 +31,12 @@ QVariant TriggerTableModel::headerData(int section, Qt::Orientation orientation,
|
|||
|
||||
void TriggerTableModel::setCatalog(std::shared_ptr<const PgDatabaseCatalog> cat)
|
||||
{
|
||||
beginResetModel();
|
||||
|
||||
m_catalog = cat;
|
||||
m_triggers = cat->triggers();//->getTriggersForRelation(table);
|
||||
|
||||
endResetModel();
|
||||
if (cat != m_catalog) {
|
||||
m_catalog = cat;
|
||||
refreshConnection = connect(m_catalog.get(), &PgDatabaseCatalog::refreshed, this,
|
||||
&TriggerTableModel::refresh);
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
|
||||
int TriggerTableModel::rowCount(const QModelIndex &) const
|
||||
|
|
@ -98,3 +99,11 @@ QVariant TriggerTableModel::getData(const QModelIndex &index) const
|
|||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void TriggerTableModel::refresh()
|
||||
{
|
||||
beginResetModel();
|
||||
SCOPE_EXIT { endResetModel(); };
|
||||
|
||||
m_triggers = m_catalog->triggers();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue