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.
58 lines
1.1 KiB
C++
58 lines
1.1 KiB
C++
#ifndef CRUDTAB_H
|
|
#define CRUDTAB_H
|
|
|
|
#include "catalog/PgClass.h"
|
|
#include <QWidget>
|
|
#include "plugin_support/PluginContentWidget.h"
|
|
#include "plugin_support/PluginModule.h"
|
|
#include <memory>
|
|
#include <optional>
|
|
|
|
namespace Ui {
|
|
class CrudTab;
|
|
}
|
|
|
|
class OpenDatabase;
|
|
class CrudModel;
|
|
|
|
class CrudTab : public PluginContentWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit CrudTab(IPluginContentWidgetContext *context, QWidget *parent = nullptr);
|
|
~CrudTab() override;
|
|
|
|
void setConfig(Oid oid);
|
|
|
|
void refresh();
|
|
|
|
virtual std::vector<QAction*> getToolbarActions() override;
|
|
private:
|
|
Ui::CrudTab *ui;
|
|
|
|
std::shared_ptr<OpenDatabase> m_db;
|
|
std::optional<PgClass> m_table;
|
|
|
|
CrudModel *m_crudModel = nullptr;
|
|
std::vector<QAction*> actions;
|
|
|
|
private slots:
|
|
void on_actionRemove_rows_triggered();
|
|
void headerCustomContextMenu(const QPoint &pos);
|
|
};
|
|
|
|
class CrudPageModule: public PluginModule {
|
|
Q_OBJECT
|
|
public:
|
|
using PluginModule::PluginModule;
|
|
|
|
void init();
|
|
private slots:
|
|
|
|
private:
|
|
void moduleAction_open(IPluginContentWidgetContext* context, const ModuleActionParameters ¶ms);
|
|
};
|
|
|
|
|
|
#endif // CRUDTAB_H
|