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.
41 lines
937 B
C++
41 lines
937 B
C++
#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
|