Some rudementary refresh support in crud tab bound to execute action (should be replaced with dynamic action list on form)
This commit is contained in:
parent
914d2fe9fa
commit
ad3f605ada
5 changed files with 16 additions and 5 deletions
|
|
@ -69,6 +69,7 @@ public:
|
||||||
|
|
||||||
virtual bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
virtual bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
||||||
|
|
||||||
|
void loadData();
|
||||||
public slots:
|
public slots:
|
||||||
virtual bool submit() override;
|
virtual bool submit() override;
|
||||||
virtual void revert() override;
|
virtual void revert() override;
|
||||||
|
|
@ -204,7 +205,6 @@ private:
|
||||||
RedirectVec m_redirectVector;
|
RedirectVec m_redirectVector;
|
||||||
|
|
||||||
|
|
||||||
void loadData();
|
|
||||||
void loadIntoModel(std::shared_ptr<Pgsql::Result> data);
|
void loadIntoModel(std::shared_ptr<Pgsql::Result> data);
|
||||||
|
|
||||||
Value getData(const QModelIndex &index) const;
|
Value getData(const QModelIndex &index) const;
|
||||||
|
|
|
||||||
|
|
@ -50,3 +50,8 @@ void CrudTab::setConfig(std::shared_ptr<OpenDatabase> db, const PgClass &table)
|
||||||
//{
|
//{
|
||||||
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
void CrudTab::refresh()
|
||||||
|
{
|
||||||
|
m_crudModel->loadData();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ public:
|
||||||
|
|
||||||
void setConfig(std::shared_ptr<OpenDatabase> db, const PgClass &table);
|
void setConfig(std::shared_ptr<OpenDatabase> db, const PgClass &table);
|
||||||
|
|
||||||
|
void refresh();
|
||||||
private:
|
private:
|
||||||
Ui::CrudTab *ui;
|
Ui::CrudTab *ui;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -181,6 +181,14 @@ void MainWindow::on_actionExecute_SQL_triggered()
|
||||||
if (tab) {
|
if (tab) {
|
||||||
tab->execute();
|
tab->execute();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
QWidget *widget = ui->tabWidget->currentWidget();
|
||||||
|
CrudTab *ct = dynamic_cast<CrudTab*>(widget);
|
||||||
|
if (ct) {
|
||||||
|
ct->refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionExplain_triggered()
|
void MainWindow::on_actionExplain_triggered()
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>993</width>
|
<width>993</width>
|
||||||
<height>22</height>
|
<height>25</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuTest">
|
<widget class="QMenu" name="menuTest">
|
||||||
|
|
@ -297,9 +297,6 @@
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Copy as raw C++-string</string>
|
<string>Copy as raw C++-string</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
|
||||||
<string>Ctrl+Alt+C</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue