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

41
pglab/TriggerPage.h Normal file
View file

@ -0,0 +1,41 @@
#ifndef TRIGGERPAGE_H
#define TRIGGERPAGE_H
#include <QObject>
#include <QSplitter>
#include <memory>
class QSplitter;
class QTableView;
class SqlCodePreview;
class PgDatabaseCatalog;
class PgClass;
class TriggerTableModel;
class CustomFilterSortModel;
class QItemSelection;
class TriggerPage : public QSplitter
{
Q_OBJECT
public:
explicit TriggerPage(QWidget *parent = nullptr);
// TriggerPage(QWidget *parent = nullptr);
void setCatalog(std::shared_ptr<const PgDatabaseCatalog> cat);
void setFilter(const PgClass &cls);
signals:
public slots:
private:
QTableView *m_tableView = nullptr;
SqlCodePreview *m_definitionView = nullptr;
TriggerTableModel *m_model = nullptr;
CustomFilterSortModel *m_sortFilterProxy = nullptr;
std::shared_ptr<const PgDatabaseCatalog> m_catalog;
private slots:
void tableView_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
};
#endif // TRIGGERPAGE_H