Sequence page refreshes after catalog reload.
This commit is contained in:
parent
5c586ea807
commit
39d1a2a00f
3 changed files with 12 additions and 5 deletions
|
|
@ -32,17 +32,21 @@ QVariant SequenceModel::headerData(int section, Qt::Orientation orientation, int
|
||||||
|
|
||||||
void SequenceModel::setCatalog(std::shared_ptr<const PgDatabaseCatalog> cat)
|
void SequenceModel::setCatalog(std::shared_ptr<const PgDatabaseCatalog> cat)
|
||||||
{
|
{
|
||||||
m_catalog = cat;
|
if (cat != m_catalog) {
|
||||||
reloadData();
|
m_catalog = cat;
|
||||||
|
refreshConnection = connect(m_catalog.get(), &PgDatabaseCatalog::refreshed,
|
||||||
|
this, &SequenceModel::refresh);
|
||||||
|
}
|
||||||
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SequenceModel::setNamespaceFilter(NamespaceFilter filter)
|
void SequenceModel::setNamespaceFilter(NamespaceFilter filter)
|
||||||
{
|
{
|
||||||
m_namespaceFilter = filter;
|
m_namespaceFilter = filter;
|
||||||
reloadData();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SequenceModel::reloadData()
|
void SequenceModel::refresh()
|
||||||
{
|
{
|
||||||
if (!m_catalog)
|
if (!m_catalog)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,9 @@ private:
|
||||||
std::shared_ptr<const PgDatabaseCatalog> m_catalog;
|
std::shared_ptr<const PgDatabaseCatalog> m_catalog;
|
||||||
std::vector<PgSequence> m_sequences;
|
std::vector<PgSequence> m_sequences;
|
||||||
NamespaceFilter m_namespaceFilter = NamespaceFilter::User;
|
NamespaceFilter m_namespaceFilter = NamespaceFilter::User;
|
||||||
|
QMetaObject::Connection refreshConnection;
|
||||||
|
|
||||||
void reloadData();
|
void refresh();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SEQUENCEMODEL_H
|
#endif // SEQUENCEMODEL_H
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ CatalogSequencesPage::CatalogSequencesPage(QWidget *parent)
|
||||||
|
|
||||||
connect(m_sequenceTable->selectionModel(), &QItemSelectionModel::currentRowChanged, this,
|
connect(m_sequenceTable->selectionModel(), &QItemSelectionModel::currentRowChanged, this,
|
||||||
&CatalogSequencesPage::sequenceTable_currentRowChanged);
|
&CatalogSequencesPage::sequenceTable_currentRowChanged);
|
||||||
|
connect(m_model, &SequenceModel::modelReset,
|
||||||
|
[this] () { selectedSequenceChanged({}); });
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue