Added listing of triggers for selected table (not completely finished).

Used slightly different approach. This tab is fully build in source code
using subclasses to adjust behaviour of widgets for reuse in the other tabs.
Uses custom proxy model for filtering triggers for correct table and supporting
out of the box sorting by QTableView.

SqlCodePreview: QPlainTextEditor which sql highlighter and in readonly mode but allows copy.
This commit is contained in:
eelke 2018-10-07 19:40:06 +02:00
parent 446923ebaf
commit 2a75e86102
23 changed files with 697 additions and 67 deletions

View file

@ -2,8 +2,10 @@
#define PGSQLDATABASECATALOGUE_H
#include <libpq-fe.h>
#include <QObject>
#include <QString>
#include <functional>
#include <bitset>
#include <memory>
#include <vector>
@ -22,9 +24,11 @@ class PgIndexContainer;
class PgNamespaceContainer;
class PgAmContainer;
class PgTablespaceContainer;
class PgTriggerContainer;
class PgTypeContainer;
class PgDatabaseCatalog: public std::enable_shared_from_this<PgDatabaseCatalog> {
class PgDatabaseCatalog: public QObject, public std::enable_shared_from_this<PgDatabaseCatalog> {
Q_OBJECT
public:
PgDatabaseCatalog();
PgDatabaseCatalog(const PgDatabaseCatalog&) = delete;
@ -49,8 +53,27 @@ public:
std::shared_ptr<const PgAmContainer> ams() const;
std::shared_ptr<const PgNamespaceContainer> namespaces() const;
std::shared_ptr<const PgTablespaceContainer> tablespaces() const;
std::shared_ptr<const PgTriggerContainer> triggers() const;
std::shared_ptr<const PgTypeContainer> types() const;
enum RefreshFlag {
Attributes = 1,
AuthIds = (1 << 1),
Classes = (1 << 2),
Constraints = (1 << 3),
Databases = (1 << 4),
Indexes = (1 << 5),
Ams = (1 << 6),
Namespaces = (1 << 7),
Tablespaces = (1 << 8),
Triggers = (1 << 9),
Types = (1 << 10),
All = 0xffffffff
};
using RefreshFlags = int;
signals:
void refreshed(const PgDatabaseCatalog *catalog, RefreshFlags flags);
private:
QString m_serverVersionString;
int m_serverVersion;
@ -65,6 +88,7 @@ private:
std::shared_ptr<PgAmContainer> m_ams;
std::shared_ptr<PgNamespaceContainer> m_namespaces;
std::shared_ptr<PgTablespaceContainer> m_tablespaces;
std::shared_ptr<PgTriggerContainer> m_triggers;
std::shared_ptr<PgTypeContainer> m_types;
template <typename T>