diff --git a/pglab/CrudModel.h b/pglab/CrudModel.h index bd1d99f..2a5de63 100644 --- a/pglab/CrudModel.h +++ b/pglab/CrudModel.h @@ -69,6 +69,7 @@ public: virtual bool setData(const QModelIndex &index, const QVariant &value, int role) override; + void loadData(); public slots: virtual bool submit() override; virtual void revert() override; @@ -204,7 +205,6 @@ private: RedirectVec m_redirectVector; - void loadData(); void loadIntoModel(std::shared_ptr data); Value getData(const QModelIndex &index) const; diff --git a/pglab/CrudTab.cpp b/pglab/CrudTab.cpp index bce0fdf..4c15dcd 100644 --- a/pglab/CrudTab.cpp +++ b/pglab/CrudTab.cpp @@ -50,3 +50,8 @@ void CrudTab::setConfig(std::shared_ptr db, const PgClass &table) //{ //} + +void CrudTab::refresh() +{ + m_crudModel->loadData(); +} diff --git a/pglab/CrudTab.h b/pglab/CrudTab.h index af9c58f..3256265 100644 --- a/pglab/CrudTab.h +++ b/pglab/CrudTab.h @@ -23,6 +23,7 @@ public: void setConfig(std::shared_ptr db, const PgClass &table); + void refresh(); private: Ui::CrudTab *ui; diff --git a/pglab/MainWindow.cpp b/pglab/MainWindow.cpp index 378f5f7..5cf2f93 100644 --- a/pglab/MainWindow.cpp +++ b/pglab/MainWindow.cpp @@ -181,6 +181,14 @@ void MainWindow::on_actionExecute_SQL_triggered() if (tab) { tab->execute(); } + else { + QWidget *widget = ui->tabWidget->currentWidget(); + CrudTab *ct = dynamic_cast(widget); + if (ct) { + ct->refresh(); + } + + } } void MainWindow::on_actionExplain_triggered() diff --git a/pglab/MainWindow.ui b/pglab/MainWindow.ui index 9ae5b3c..d0cbb29 100644 --- a/pglab/MainWindow.ui +++ b/pglab/MainWindow.ui @@ -45,7 +45,7 @@ 0 0 993 - 22 + 25 @@ -297,9 +297,6 @@ Copy as raw C++-string - - Ctrl+Alt+C -