完成主窗口工具栏中的‘刷新’按钮逻辑
This commit is contained in:
parent
a8644514ad
commit
2dfdb84c51
|
|
@ -20,6 +20,7 @@ public:
|
|||
void disconnectCurConnection();
|
||||
const QString curConnection();
|
||||
void onActionTrigger_removeModel();
|
||||
void onActionTrigger_refresh();
|
||||
|
||||
protected:
|
||||
void mouseDoubleClickEvent(QMouseEvent* event) override;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@ private slots:
|
|||
void onActionTrigger_addModel();
|
||||
void onActionTrigger_updateModel(int);
|
||||
void onActionTrigger_removeModel();
|
||||
void onActionTrigger_addGroup(int);
|
||||
void onActionTrigger_refresh();
|
||||
void onActionTrigger_addGroup(int);
|
||||
|
||||
void onSIG_addConnection(const DatabaseConfig&);
|
||||
void onSIG_updateConnectionInfo(const DatabaseConfig&);
|
||||
|
|
|
|||
|
|
@ -191,6 +191,7 @@ DBStructureNode* DBStructureView::currentNode()
|
|||
void DBStructureView::onActionTrigger_removeModel()
|
||||
{
|
||||
DBStructureNode* node = currentNode();
|
||||
|
||||
if(!node || (node->type() != TableNode && node->type() != GroupNode))
|
||||
{
|
||||
if(m_pMainWindow)
|
||||
|
|
@ -225,6 +226,27 @@ void DBStructureView::onActionTrigger_removeModel()
|
|||
}
|
||||
}
|
||||
|
||||
void DBStructureView::onActionTrigger_refresh()
|
||||
{
|
||||
DBStructureNode* node = currentNode();
|
||||
if(!node)
|
||||
return;
|
||||
|
||||
if(node->type() == ConnectionNode && node->status() == Connect)
|
||||
{
|
||||
QString connName = node->name();
|
||||
DBStructureModel* model = dynamic_cast<DBStructureModel*>(this->model());
|
||||
if(model)
|
||||
model->refreshStructure_Connection(connName);
|
||||
}
|
||||
else if(node && node->type() == TableNode)
|
||||
{
|
||||
DBStructureModel* model = dynamic_cast<DBStructureModel*>(this->model());
|
||||
if(model && node->parentNode())
|
||||
model->refreshStructure_Model(node->parentNode()->name(), node->data(Qt::UserRole + NodeDataRole::ID).toInt());
|
||||
}
|
||||
}
|
||||
|
||||
void DBStructureView::itemDoubleClick(const QModelIndex& index)
|
||||
{
|
||||
DBStructureNode* node = static_cast<DBStructureNode*>(index.internalPointer());
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ void MainWindow::initialize()
|
|||
connect(ui->createTableAction, &QAction::triggered, this, &MainWindow::onActionTrigger_addModel);
|
||||
connect(ui->deleteTableAction, &QAction::triggered, this, &MainWindow::onActionTrigger_removeModel);
|
||||
|
||||
connect(ui->refreshAction, &QAction::triggered, this, &MainWindow::onActionTrigger_refresh);
|
||||
|
||||
connect(&SqlQueryExecutor::instance(), &SqlQueryExecutor::errorOccurred, this, &MainWindow::onSIG_errorFormSQLExecutor);
|
||||
|
||||
MaskManager::initialize(this);
|
||||
|
|
@ -268,6 +270,11 @@ void MainWindow::onActionTrigger_removeModel()
|
|||
if(m_pDBStrutureView)
|
||||
m_pDBStrutureView->onActionTrigger_removeModel();
|
||||
}
|
||||
void MainWindow::onActionTrigger_refresh()
|
||||
{
|
||||
if(m_pDBStrutureView)
|
||||
m_pDBStrutureView->onActionTrigger_refresh();
|
||||
}
|
||||
|
||||
void MainWindow::onSIG_addConnection(const DatabaseConfig& config)
|
||||
{
|
||||
|
|
@ -338,7 +345,7 @@ void MainWindow::onSIG_connectionStatusChanged(const QString& strConnectionName,
|
|||
ui->importAciton->setEnabled(bConnected);
|
||||
ui->exportAction->setEnabled(bConnected);
|
||||
ui->refreshAction->setEnabled(bConnected);
|
||||
ui->saveAction->setEnabled(bConnected);
|
||||
//ui->saveAction->setEnabled(bConnected);
|
||||
}
|
||||
|
||||
void MainWindow::onSIG_addModel(Model& model)
|
||||
|
|
|
|||
|
|
@ -261,7 +261,6 @@ background-color:rgb(211, 241, 250);
|
|||
<addaction name="exportAction"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="refreshAction"/>
|
||||
<addaction name="saveAction"/>
|
||||
<addaction name="separator"/>
|
||||
</widget>
|
||||
<action name="createTableAction">
|
||||
|
|
@ -357,27 +356,6 @@ background-color:rgb(211, 241, 250);
|
|||
<enum>QAction::MenuRole::NoRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
<action name="saveAction">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resource/PowerModeler.qrc">
|
||||
<normaloff>:/img/images/icon_save.png</normaloff>:/img/images/icon_save.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>保存</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>保存</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+S</string>
|
||||
</property>
|
||||
<property name="menuRole">
|
||||
<enum>QAction::MenuRole::NoRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
<action name="connectAction">
|
||||
<property name="icon">
|
||||
<iconset resource="../resource/PowerModeler.qrc">
|
||||
|
|
|
|||
Loading…
Reference in New Issue