From 753a4a9e0c574fa7b805171ab4b50d9b195c0d44 Mon Sep 17 00:00:00 2001 From: duanshengchao <519970194@qq.com> Date: Fri, 25 Apr 2025 16:44:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E9=A1=B5=E7=A0=81=E6=83=B3?= =?UTF-8?q?=E8=BF=87=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/dbBrowser.cpp | 17 +++++++++++++++-- source/dbStructureView.cpp | 13 ++----------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/source/dbBrowser.cpp b/source/dbBrowser.cpp index e1417ee..1b04f53 100644 --- a/source/dbBrowser.cpp +++ b/source/dbBrowser.cpp @@ -141,6 +141,11 @@ void DatabaseBrowser::onCurrentTabChanged(int index) ui->btnRefresh->setEnabled(false); ui->btnSave->setEnabled(false); ui->btnCancle->setEnabled(false); + + ui->btnFirstPage->setEnabled(false); + ui->btnPreviousPage->setEnabled(false); + ui->btnNextPage->setEnabled(false); + ui->btnLastPage->setEnabled(false); ui->recordInfo->clear(); ui->lineEditPage->setEnabled(false); ui->lineEditPage->setText("1"); @@ -156,6 +161,13 @@ void DatabaseBrowser::onCurrentTabChanged(int index) ui->btnRemove->setEnabled(true); ui->btnCancle->setEnabled(true); ui->btnRefresh->setEnabled(true); + + ui->btnFirstPage->setEnabled(true); + ui->btnPreviousPage->setEnabled(true); + ui->btnNextPage->setEnabled(true); + ui->btnLastPage->setEnabled(true); + ui->lineEditPage->setEnabled(true); + attributeView->active(); } } @@ -308,7 +320,9 @@ void DatabaseBrowser::onEditingFinished_page() if(view && model) { QString strPage = ui->lineEditPage->text(); - model->setCurrentPage(strPage.toInt()); + bool result = model->setCurrentPage(strPage.toInt()); + if(!result) + ui->lineEditPage->setText(QString::number(model->currentPage())); } } @@ -322,7 +336,6 @@ void DatabaseBrowser::onSyncDataStatus(bool hasModifiedData, const PaginationInf QString recordInfo = QString::fromWCharArray(L"共 %1 条记录").arg(paginationInfo.totalEntries); ui->recordInfo->setText(recordInfo); ui->lineEditPage->setText(QString::number(paginationInfo.currentPage)); - ui->lineEditPage->setEnabled(true); } void DatabaseBrowser::onShowMessage(MessageDialogType type,const QString& strTitle,const QString& strContent) diff --git a/source/dbStructureView.cpp b/source/dbStructureView.cpp index d77a236..8fda7bd 100644 --- a/source/dbStructureView.cpp +++ b/source/dbStructureView.cpp @@ -308,18 +308,9 @@ void DBStructureView::showContextMenu(const QPoint& pos) else if(node && node->type() == GroupNode) { CustomMenu menu; + bool isPublic = node->data(Qt::UserRole + NodeDataRole::Type).toBool(); menu.addAction(QString::fromWCharArray(L"打开"), [this, node]{openAttributeGroup(node);}); menu.addAction(QString::fromWCharArray(L"删除"), [this, node]{ - bool isPublic = node->data(Qt::UserRole + NodeDataRole::Type).toBool(); - if(isPublic) - { - if(m_pMainWindow) - { - m_pMainWindow->showMessageDialog(type_warning, QString::fromWCharArray(L"错误"), - QString::fromWCharArray(L"该属性组属于必备组别,不可删除")); - } - return; - } if(m_pMainWindow) { m_pMainWindow->showMessageDialog(type_question, QString::fromWCharArray(L"提示"), @@ -331,7 +322,7 @@ void DBStructureView::showContextMenu(const QPoint& pos) closeAttributeGroup(node); //移除节点 removeNode(node); - }); + })->setEnabled(!isPublic); menu.addSeparator(); menu.addAction(QString::fromWCharArray(L"清空数据"), []{}); QPoint originPoint = this->mapToGlobal(QPoint(0,0));