2025-03-14 16:06:20 +08:00
|
|
|
|
#include "mainwindow.h"
|
|
|
|
|
|
#include "./ui_mainwindow.h"
|
2025-04-14 12:10:07 +08:00
|
|
|
|
#include "maskManager.h"
|
2025-03-14 16:06:20 +08:00
|
|
|
|
#include "dbManager.h"
|
2025-03-18 18:35:30 +08:00
|
|
|
|
#include "dbBrowser.h"
|
2025-03-14 16:06:20 +08:00
|
|
|
|
#include "connectionDialog.h"
|
|
|
|
|
|
#include "dbStructureView.h"
|
|
|
|
|
|
#include "dbStructureModel.h"
|
|
|
|
|
|
#include "logger.h"
|
|
|
|
|
|
#include "sqlQueryExecutor.h"
|
|
|
|
|
|
#include "modelInfoEditDialog.h"
|
2025-04-18 18:44:26 +08:00
|
|
|
|
#include "groupSelectionDialog.h"
|
2025-04-29 17:54:44 +08:00
|
|
|
|
#include "attributeSelector.h"
|
2025-03-14 16:06:20 +08:00
|
|
|
|
|
|
|
|
|
|
#include <QKeyEvent>
|
|
|
|
|
|
#include <QScreen>
|
|
|
|
|
|
|
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
|
|
|
|
: QMainWindow(parent)
|
|
|
|
|
|
, ui(new Ui::MainWindow)
|
|
|
|
|
|
, m_dbManager(nullptr)
|
2025-03-18 18:35:30 +08:00
|
|
|
|
, m_dbBrowser(nullptr)
|
2025-03-14 16:06:20 +08:00
|
|
|
|
, m_pMessageDialog(nullptr)
|
|
|
|
|
|
, m_pConnectionDialog(nullptr)
|
|
|
|
|
|
, m_pModelInfoDialog(nullptr)
|
2025-04-18 18:44:26 +08:00
|
|
|
|
, m_pGroupSelectionDialog(nullptr)
|
2025-04-29 17:54:44 +08:00
|
|
|
|
, m_pAttributeSelector(nullptr)
|
2025-03-14 16:06:20 +08:00
|
|
|
|
{
|
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
|
|
|
|
initialize();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
|
|
{
|
|
|
|
|
|
delete ui;
|
|
|
|
|
|
LOG_INFO("Application", "------------------------------------------------Application exit------------------------------------------------");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MainWindow::eventFilter(QObject* obj, QEvent* event)
|
|
|
|
|
|
{
|
|
|
|
|
|
QDialog *pDialog = qobject_cast<QDialog*>(obj);
|
|
|
|
|
|
if(pDialog)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(event->type() == QEvent::KeyPress)
|
|
|
|
|
|
{
|
|
|
|
|
|
QKeyEvent* pKeyEvent = static_cast<QKeyEvent*>(event);
|
|
|
|
|
|
if (pKeyEvent->key() == Qt::Key_Escape)
|
|
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return QObject::eventFilter(obj, event);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-11 17:14:17 +08:00
|
|
|
|
void MainWindow::resizeEvent(QResizeEvent* event)
|
|
|
|
|
|
{
|
|
|
|
|
|
QWidget::resizeEvent(event);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-14 16:06:20 +08:00
|
|
|
|
void MainWindow::initialize()
|
|
|
|
|
|
{
|
|
|
|
|
|
connect(ui->connectAction, &QAction::triggered, this, &MainWindow::onActionTrigger_connect);
|
|
|
|
|
|
connect(ui->disconnectAction, &QAction::triggered, this, &MainWindow::onActionTrigger_disconnect);
|
|
|
|
|
|
|
|
|
|
|
|
connect(ui->createTableAction, &QAction::triggered, this, &MainWindow::onActionTrigger_addModel);
|
|
|
|
|
|
connect(ui->deleteTableAction, &QAction::triggered, this, &MainWindow::onActionTrigger_removeModel);
|
|
|
|
|
|
|
|
|
|
|
|
connect(&SqlQueryExecutor::instance(), &SqlQueryExecutor::errorOccurred, this, &MainWindow::onSIG_errorFormSQLExecutor);
|
|
|
|
|
|
|
2025-04-14 12:10:07 +08:00
|
|
|
|
MaskManager::initialize(this);
|
2025-04-11 17:14:17 +08:00
|
|
|
|
|
2025-03-14 16:06:20 +08:00
|
|
|
|
m_dbManager = new DatabaseManager(this);
|
|
|
|
|
|
connect(m_dbManager, &DatabaseManager::errorOccurred, this, &MainWindow::onSIG_errorFromDBManger);
|
|
|
|
|
|
connect(m_dbManager, &DatabaseManager::connectionStatusChanged, this, &MainWindow::onSIG_connectionStatusChanged);
|
|
|
|
|
|
|
2025-03-18 18:35:30 +08:00
|
|
|
|
m_dbBrowser = new DatabaseBrowser(this);
|
2025-03-26 15:57:08 +08:00
|
|
|
|
m_dbBrowser->setMainWindow(this);
|
2025-04-29 17:54:44 +08:00
|
|
|
|
connect(m_dbBrowser, &DatabaseBrowser::openAttributeSelector, this, &MainWindow::onSIG_openAttributeSelector);
|
2025-03-18 18:35:30 +08:00
|
|
|
|
ui->layoutAttributeBrowser->addWidget(m_dbBrowser);
|
|
|
|
|
|
|
2025-03-14 16:06:20 +08:00
|
|
|
|
m_pDBStrutureView = new DBStructureView(m_dbManager, this);
|
2025-03-17 17:20:10 +08:00
|
|
|
|
m_pDBStrutureView->setMainWindow(this);
|
2025-03-14 16:06:20 +08:00
|
|
|
|
connect(m_pDBStrutureView, &DBStructureView::actionTrigger_addModel, this, &MainWindow::onActionTrigger_addModel);
|
2025-04-18 18:44:26 +08:00
|
|
|
|
connect(m_pDBStrutureView, &DBStructureView::actionTrigger_addGroup, this, &MainWindow::onActionTrigger_addGroup);
|
2025-03-24 18:13:06 +08:00
|
|
|
|
connect(m_pDBStrutureView, &DBStructureView::openAttributeInfo, this, &MainWindow::onSIG_openAttributeInfo);
|
2025-04-17 15:34:43 +08:00
|
|
|
|
connect(m_pDBStrutureView, &DBStructureView::closeAttributeInfo, this, &MainWindow::onSIG_closeAttributeInfo);
|
2025-04-25 11:49:03 +08:00
|
|
|
|
connect(m_pDBStrutureView, &DBStructureView::closeAllAttributeInfo, this, &MainWindow::onSIG_closeAllAttributeInfo);
|
2025-03-14 16:06:20 +08:00
|
|
|
|
ui->layoutDBStructure->addWidget(m_pDBStrutureView);
|
|
|
|
|
|
m_pDBStrutureModel = new DBStructureModel(this);
|
2025-03-17 17:20:10 +08:00
|
|
|
|
m_pDBStrutureModel->setMainWindow(this);
|
2025-03-14 16:06:20 +08:00
|
|
|
|
m_pDBStrutureView->setModel(m_pDBStrutureModel);
|
|
|
|
|
|
|
|
|
|
|
|
QScreen* screen = this->screen();
|
|
|
|
|
|
int nWidth = screen->size().width() * 0.8;
|
|
|
|
|
|
int nHeight = screen->size().height() * 0.8;
|
|
|
|
|
|
this->resize(nWidth, nHeight);
|
2025-03-18 18:35:30 +08:00
|
|
|
|
//在子部件内含有复杂布局和嵌套空间的时候,setStretchFactor会失效,固采用setSizes的方法来设置初始大小
|
|
|
|
|
|
QVector<double> factor{1.0, 6.0};
|
|
|
|
|
|
int nDBStructureWidth = nWidth * (factor.at(0) / (factor.at(0) + factor.at(1)));
|
|
|
|
|
|
int nDBBrowserWidth = nWidth - nDBStructureWidth;
|
|
|
|
|
|
ui->splitter->setSizes({nDBStructureWidth, nDBBrowserWidth});
|
|
|
|
|
|
// ui->splitter->setStretchFactor(0, 1);
|
|
|
|
|
|
// ui->splitter->setStretchFactor(1, 7);
|
2025-03-14 16:06:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::showMessageDialog(MessageDialogType type,const QString& strTitle,const QString& strContent)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(m_pMessageDialog == nullptr)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_pMessageDialog = new MessageDialog(this);
|
|
|
|
|
|
m_pMessageDialog->installEventFilter(this);
|
2025-04-16 16:37:32 +08:00
|
|
|
|
//对话框必须是close才会发送finished信号,hide不可以
|
|
|
|
|
|
connect(m_pMessageDialog, &MessageDialog::finished, this, [=](int result){MaskManager::instance()->hideMask(m_pMessageDialog);});
|
2025-03-14 16:06:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_pMessageDialog->setMessage(type, strTitle, strContent);
|
2025-04-30 10:56:49 +08:00
|
|
|
|
int nX = (this->width() - m_pMessageDialog->width()) * 0.5;
|
|
|
|
|
|
int nY = (this->height() - m_pMessageDialog->height()) * 0.5;
|
2025-04-16 16:37:32 +08:00
|
|
|
|
|
2025-04-21 16:57:09 +08:00
|
|
|
|
if(QSysInfo::kernelType() == "linux")
|
|
|
|
|
|
MaskManager::instance()->showMask(m_pMessageDialog);
|
2025-04-30 10:56:49 +08:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
nX += this->geometry().x();
|
|
|
|
|
|
nY += this->geometry().y();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_pMessageDialog->move(nX, nY);
|
2025-03-14 16:06:20 +08:00
|
|
|
|
m_pMessageDialog->exec();
|
|
|
|
|
|
}
|
|
|
|
|
|
void MainWindow::hideMessageDialog()
|
|
|
|
|
|
{
|
|
|
|
|
|
if(m_pMessageDialog && m_pMessageDialog->isVisible())
|
|
|
|
|
|
m_pMessageDialog->close();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const QString MainWindow::getCurConnection()
|
|
|
|
|
|
{
|
|
|
|
|
|
if(m_pDBStrutureView)
|
|
|
|
|
|
return m_pDBStrutureView->curConnection();
|
|
|
|
|
|
else
|
|
|
|
|
|
return QString("");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::onActionTrigger_connect()
|
|
|
|
|
|
{
|
|
|
|
|
|
if(m_pConnectionDialog && m_pConnectionDialog->isVisible())
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
// if(m_dbManager->conncetions().count() >=1 ) //暂时只支持一个链接
|
|
|
|
|
|
// {
|
|
|
|
|
|
// showMessageDialog(type_information, QString::fromWCharArray(L"提示"), QString::fromWCharArray(L"若要开启新的图模库链接,请先断开当前链接"));
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
if(m_pConnectionDialog == nullptr)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_pConnectionDialog = new ConnectionDialog(this);
|
|
|
|
|
|
m_pConnectionDialog->setMainWindow(this);
|
|
|
|
|
|
m_pConnectionDialog->installEventFilter(this);
|
|
|
|
|
|
connect(m_pConnectionDialog, &ConnectionDialog::addConnection, this, &MainWindow::onSIG_addConnection);
|
2025-04-16 16:37:32 +08:00
|
|
|
|
connect(m_pConnectionDialog, &ConnectionDialog::finished, this, [=]{ MaskManager::instance()->hideMask(m_pConnectionDialog);});
|
2025-03-14 16:06:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-30 10:56:49 +08:00
|
|
|
|
int nX = (this->width() - m_pConnectionDialog->width()) * 0.5;
|
|
|
|
|
|
int nY = (this->height() - m_pConnectionDialog->height()) * 0.5;
|
2025-04-03 18:01:23 +08:00
|
|
|
|
// QPoint centerPos = this->mapToGlobal(this->rect().center());
|
|
|
|
|
|
// centerPos -= QPoint(m_pConnectionDialog->width()/2, m_pConnectionDialog->height()/2);
|
|
|
|
|
|
// m_pConnectionDialog->move(centerPos);
|
2025-04-11 17:14:17 +08:00
|
|
|
|
|
2025-04-21 16:57:09 +08:00
|
|
|
|
if(QSysInfo::kernelType() == "linux")
|
|
|
|
|
|
{
|
2025-04-30 10:56:49 +08:00
|
|
|
|
//因为linux下子窗口去掉了Dialog属性,所以只需要按照相对坐标计算即可(this->geometry()的x和y值在Linux的多屏环境下计算也不准)
|
|
|
|
|
|
m_pConnectionDialog->move(nX, nY);
|
2025-04-21 16:57:09 +08:00
|
|
|
|
MaskManager::instance()->showMask(m_pConnectionDialog);
|
|
|
|
|
|
m_pConnectionDialog->show();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
2025-04-30 10:56:49 +08:00
|
|
|
|
{
|
|
|
|
|
|
nX += this->geometry().x();
|
|
|
|
|
|
nY += this->geometry().y();
|
|
|
|
|
|
m_pConnectionDialog->move(nX, nY);
|
2025-04-21 16:57:09 +08:00
|
|
|
|
m_pConnectionDialog->exec();
|
2025-04-30 10:56:49 +08:00
|
|
|
|
}
|
2025-03-14 16:06:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
void MainWindow::onActionTrigger_disconnect()
|
|
|
|
|
|
{
|
|
|
|
|
|
if(m_pDBStrutureView)
|
|
|
|
|
|
m_pDBStrutureView->disconnectCurConnection();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::onActionTrigger_addModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
if(m_pModelInfoDialog && m_pModelInfoDialog->isVisible())
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if(m_pModelInfoDialog == nullptr)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_pModelInfoDialog = new ModelInfoEditDialog(this);
|
|
|
|
|
|
m_pModelInfoDialog->setMainWindow(this);
|
|
|
|
|
|
m_pModelInfoDialog->installEventFilter(this);
|
|
|
|
|
|
connect(m_pModelInfoDialog, &ModelInfoEditDialog::addModel, this, &MainWindow::onSIG_addModel);
|
2025-04-18 18:44:26 +08:00
|
|
|
|
connect(m_pModelInfoDialog, &ModelInfoEditDialog::finished, this, [=]{ MaskManager::instance()->hideMask(m_pModelInfoDialog);});
|
2025-03-14 16:06:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-30 10:56:49 +08:00
|
|
|
|
int nX = (this->width() - m_pModelInfoDialog->width()) * 0.5;
|
|
|
|
|
|
int nY = (this->height() - m_pModelInfoDialog->height()) * 0.5;
|
|
|
|
|
|
|
2025-03-14 16:06:20 +08:00
|
|
|
|
m_pModelInfoDialog->setState(DS_New);
|
2025-04-11 17:14:17 +08:00
|
|
|
|
|
2025-04-21 16:57:09 +08:00
|
|
|
|
if(QSysInfo::kernelType() == "linux")
|
|
|
|
|
|
{
|
|
|
|
|
|
MaskManager::instance()->showMask(m_pModelInfoDialog);
|
2025-04-30 10:56:49 +08:00
|
|
|
|
m_pModelInfoDialog->move(nX, nY);
|
2025-04-21 16:57:09 +08:00
|
|
|
|
m_pModelInfoDialog->show();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
2025-04-30 10:56:49 +08:00
|
|
|
|
{
|
|
|
|
|
|
nX += this->geometry().x();
|
|
|
|
|
|
nY += this->geometry().y();
|
|
|
|
|
|
m_pModelInfoDialog->move(nX, nY);
|
2025-04-21 16:57:09 +08:00
|
|
|
|
m_pModelInfoDialog->exec();
|
2025-04-30 10:56:49 +08:00
|
|
|
|
}
|
2025-03-14 16:06:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
void MainWindow::onActionTrigger_removeModel()
|
|
|
|
|
|
{
|
2025-03-17 17:20:10 +08:00
|
|
|
|
if(m_pDBStrutureView)
|
|
|
|
|
|
m_pDBStrutureView->onActionTrigger_removeModel();
|
2025-03-14 16:06:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::onSIG_addConnection(DatabaseConfig& config)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool result = m_dbManager->addDatabase(config);
|
|
|
|
|
|
if(!result)
|
|
|
|
|
|
{
|
|
|
|
|
|
//m_pConnectionDialog->setErrorInfo(m_lastSqlError.databaseText());
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_pConnectionDialog->close();
|
|
|
|
|
|
m_pDBStrutureModel->addConnection(config.strConnectionName, config.strDBType);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-18 18:44:26 +08:00
|
|
|
|
void MainWindow::onActionTrigger_addGroup(int modelID)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(m_pGroupSelectionDialog && m_pGroupSelectionDialog->isVisible())
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if(m_pGroupSelectionDialog == nullptr)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_pGroupSelectionDialog = new GroupSelectionDialog(this);
|
|
|
|
|
|
m_pGroupSelectionDialog->setMainWindow(this);
|
|
|
|
|
|
m_pGroupSelectionDialog->installEventFilter(this);
|
|
|
|
|
|
connect(m_pGroupSelectionDialog, &GroupSelectionDialog::addGroups, this, &MainWindow::onSIG_addGroups);
|
|
|
|
|
|
connect(m_pGroupSelectionDialog, &GroupSelectionDialog::finished, this, [=]{ MaskManager::instance()->hideMask(m_pGroupSelectionDialog);});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-30 10:56:49 +08:00
|
|
|
|
int nX = (this->width() - m_pGroupSelectionDialog->width()) * 0.5;
|
|
|
|
|
|
int nY = (this->height() - m_pGroupSelectionDialog->height()) * 0.5;
|
2025-04-18 18:44:26 +08:00
|
|
|
|
m_pGroupSelectionDialog->setModel(modelID);
|
|
|
|
|
|
|
2025-04-21 16:57:09 +08:00
|
|
|
|
if(QSysInfo::kernelType() == "linux")
|
|
|
|
|
|
{
|
|
|
|
|
|
MaskManager::instance()->showMask(m_pGroupSelectionDialog);
|
2025-04-30 10:56:49 +08:00
|
|
|
|
m_pGroupSelectionDialog->move(nX, nY);
|
2025-04-21 16:57:09 +08:00
|
|
|
|
m_pGroupSelectionDialog->show();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
2025-04-30 10:56:49 +08:00
|
|
|
|
{
|
|
|
|
|
|
nX += this->geometry().x();
|
|
|
|
|
|
nY += this->geometry().y();
|
|
|
|
|
|
m_pGroupSelectionDialog->move(nX, nY);
|
2025-04-21 16:57:09 +08:00
|
|
|
|
m_pGroupSelectionDialog->exec();
|
2025-04-30 10:56:49 +08:00
|
|
|
|
}
|
2025-04-18 18:44:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-02 18:29:56 +08:00
|
|
|
|
void MainWindow::onSIG_errorFromDBManger(const QString& strConnectionName, const QString& error)
|
2025-03-14 16:06:20 +08:00
|
|
|
|
{
|
2025-04-02 18:29:56 +08:00
|
|
|
|
//m_lastSqlError = error;
|
|
|
|
|
|
showMessageDialog(type_warning, QString::fromWCharArray(L"错误"),error);
|
2025-03-14 16:06:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::onSIG_errorFormSQLExecutor(const QString& error)
|
|
|
|
|
|
{
|
|
|
|
|
|
showMessageDialog(type_warning, QString::fromWCharArray(L"错误"),error);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::onSIG_connectionStatusChanged(const QString& strConnectionName, bool bConnected)
|
|
|
|
|
|
{
|
|
|
|
|
|
ui->createTableAction->setEnabled(bConnected);
|
|
|
|
|
|
ui->deleteTableAction->setEnabled(bConnected);
|
|
|
|
|
|
ui->importAciton->setEnabled(bConnected);
|
|
|
|
|
|
ui->exportAction->setEnabled(bConnected);
|
|
|
|
|
|
ui->refreshAction->setEnabled(bConnected);
|
|
|
|
|
|
ui->saveAction->setEnabled(bConnected);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::onSIG_addModel(Model& model)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString connection = m_pDBStrutureView->curConnection();
|
|
|
|
|
|
m_pDBStrutureModel->addDataModel(connection, model);
|
|
|
|
|
|
}
|
2025-03-24 18:13:06 +08:00
|
|
|
|
|
2025-04-18 18:44:26 +08:00
|
|
|
|
void MainWindow::onSIG_addGroups(int modelID, QVector<int> groups)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString connection = m_pDBStrutureView->curConnection();
|
|
|
|
|
|
m_pDBStrutureModel->addDataGroup(connection, modelID, groups);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-24 18:13:06 +08:00
|
|
|
|
void MainWindow::onSIG_openAttributeInfo(const QString& connection, ModelAttributeGroup& attributeGroup)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(m_dbBrowser)
|
|
|
|
|
|
m_dbBrowser->addTab_attribute(connection, attributeGroup);
|
|
|
|
|
|
}
|
2025-04-17 15:34:43 +08:00
|
|
|
|
|
|
|
|
|
|
void MainWindow::onSIG_closeAttributeInfo(ModelAttributeGroup& attributeGroup)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(m_dbBrowser)
|
|
|
|
|
|
m_dbBrowser->closeTab_attribute(attributeGroup);
|
|
|
|
|
|
}
|
2025-04-25 11:49:03 +08:00
|
|
|
|
|
|
|
|
|
|
void MainWindow::onSIG_closeAllAttributeInfo()
|
|
|
|
|
|
{
|
|
|
|
|
|
if(m_dbBrowser)
|
|
|
|
|
|
m_dbBrowser->closeAllTab_attribute();
|
|
|
|
|
|
}
|
2025-04-29 17:54:44 +08:00
|
|
|
|
|
|
|
|
|
|
void MainWindow::onSIG_openAttributeSelector()
|
|
|
|
|
|
{
|
|
|
|
|
|
if(m_pAttributeSelector && m_pAttributeSelector->isVisible())
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if(m_pAttributeSelector == nullptr)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_pAttributeSelector = new AttributeSelector(getCurConnection(), this);
|
|
|
|
|
|
m_pAttributeSelector->setMainWindow(this);
|
|
|
|
|
|
m_pAttributeSelector->installEventFilter(this);
|
2025-05-07 17:34:27 +08:00
|
|
|
|
connect(m_pAttributeSelector, &AttributeSelector::finished, this, [=]{ MaskManager::instance()->hideMask(m_pAttributeSelector); });
|
2025-04-29 17:54:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-30 10:56:49 +08:00
|
|
|
|
int nX = (this->width() - m_pAttributeSelector->width()) * 0.5;
|
|
|
|
|
|
int nY = (this->height() - m_pAttributeSelector->height()) * 0.5;
|
2025-04-29 17:54:44 +08:00
|
|
|
|
|
|
|
|
|
|
if(QSysInfo::kernelType() == "linux")
|
|
|
|
|
|
{
|
|
|
|
|
|
MaskManager::instance()->showMask(m_pAttributeSelector);
|
2025-04-30 10:56:49 +08:00
|
|
|
|
m_pAttributeSelector->move(nX, nY);
|
2025-04-29 17:54:44 +08:00
|
|
|
|
m_pAttributeSelector->show();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
2025-04-30 10:56:49 +08:00
|
|
|
|
{
|
|
|
|
|
|
nX += this->geometry().x();
|
|
|
|
|
|
nY += this->geometry().y();
|
|
|
|
|
|
m_pAttributeSelector->move(nX, nY);
|
2025-04-29 17:54:44 +08:00
|
|
|
|
m_pAttributeSelector->exec();
|
2025-04-30 10:56:49 +08:00
|
|
|
|
}
|
2025-04-29 17:54:44 +08:00
|
|
|
|
}
|