pgLab/pglab/TablesPage.h
eelke b0cd47ef46 Extended the plugin system to allow for dynamic runtime bindings between modules.
As a test implementation, this allows the TablesPage to open a CrudTab for a table/view without
the need for TablesPage, CrudTab and DatabaseWindow to know anything about each other.
2018-12-31 15:26:36 +01:00

71 lines
2.2 KiB
C++

#ifndef TABLESPAGE_H
#define TABLESPAGE_H
#include <QWidget>
#include <memory>
#include <optional>
#include <QItemSelection>
#include "TablesTableModel.h"
#include "plugin_support/PluginContentWidget.h"
#include "plugin_support/PluginModule.h"
namespace Ui {
class TablesPage;
}
class TablesTableModel;
class ColumnPage;
class ColumnTableModel;
class ConstraintModel;
class PgDatabaseCatalog;
class NamespaceFilterWidget;
class IndexModel;
class PropertiesPage;
class TriggerPage;
class PgClass;
class SqlCodePreview;
class TablesPage : public PluginContentWidget
{
Q_OBJECT
public:
explicit TablesPage(IPluginContentWidgetContext *context, QWidget *parent = nullptr);
~TablesPage();
void setCatalog(std::shared_ptr<PgDatabaseCatalog> cat);
void setNamespaceFilter(TablesTableModel::NamespaceFilter filter);
private:
Ui::TablesPage *ui;
// QWidget *m_columnsTab;
ColumnPage *m_columnsPage;
// QWidget *m_propertiesTab;
PropertiesPage *m_propertiesPage;
// QWidget *m_triggerTab;
TriggerPage *m_triggerPage;
SqlCodePreview *m_sqlCodePreview;
std::shared_ptr<PgDatabaseCatalog> m_catalog;
TablesTableModel* m_tablesModel = nullptr;
ColumnTableModel* m_columnsModel = nullptr;
ConstraintModel* m_constraintModel = nullptr;
IndexModel* m_indexModel = nullptr;
//NamespaceFilterWidget* m_namespaceFilterWidget;
void retranslateUi(bool all = true);
// QWidget* addDetailTab(QWidget *contents, bool infront = false);
void selectedTableChanged(const std::optional<PgClass> &table);
void updateSqlTab(const std::optional<PgClass> &table);
private slots:
void tableListTable_currentRowChanged(const QModelIndex &current, const QModelIndex &previous);
void tableListTable_layoutChanged(const QList<QPersistentModelIndex> &parents, QAbstractItemModel::LayoutChangeHint hint);
// void constraintsTable_currentRowChanged(const QModelIndex &current, const QModelIndex &previous);
void constraintsTable_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
void constraintsTable_modelReset();
void indexesTable_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
void indexesTable_modelReset();
void on_tableListTable_doubleClicked(const QModelIndex &index);
};
#endif // TABLESPAGE_H