完成public类型属性组编辑自动同步
This commit is contained in:
parent
4a5a076880
commit
1695da875e
|
|
@ -44,6 +44,7 @@ set(H_HEADER_FILES
|
|||
include/maskManager.h
|
||||
include/customBorderContainer.h
|
||||
include/groupSelectionDialog.h
|
||||
include/dataSyncManager.h
|
||||
)
|
||||
|
||||
set(CPP_SOURCE_FILES
|
||||
|
|
@ -74,6 +75,7 @@ set(CPP_SOURCE_FILES
|
|||
source/maskManager.cpp
|
||||
source/customBorderContainer.cpp
|
||||
source/groupSelectionDialog.cpp
|
||||
source/dataSyncManager.cpp
|
||||
)
|
||||
|
||||
set(UI_FILES
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public:
|
|||
//分页控制
|
||||
void setPageSize(int);
|
||||
int pageSize() const;
|
||||
void setCurrentPage(int);
|
||||
bool setCurrentPage(int);
|
||||
int currentPage() const;
|
||||
int totalPages() const;
|
||||
void previousPage();
|
||||
|
|
@ -73,6 +73,7 @@ public:
|
|||
//数据操作
|
||||
//void setTable(const QString&);
|
||||
void refresh();
|
||||
void forceRefresh(); //强制刷新(不会出现询问提示,数据同步时会用到)
|
||||
void insertRecord(int);
|
||||
void removeRecord(int);
|
||||
void submitChanges(); //提交更改(增、删、改)
|
||||
|
|
@ -84,6 +85,7 @@ public:
|
|||
//others
|
||||
QMap<int, DataType> getDataTypes() {return m_dataTypes;}
|
||||
void triggerSyncSignal();
|
||||
bool dataHasbeenModified() {return !m_modifiedRows.isEmpty();};
|
||||
|
||||
signals:
|
||||
void syncDataStatus(bool, const PaginationInfo&);
|
||||
|
|
|
|||
|
|
@ -25,10 +25,15 @@ public:
|
|||
AttributeTableDelegate* delegate() const { return m_attributeTableDelegate; }
|
||||
|
||||
void active();
|
||||
void syncChangeRecord();
|
||||
|
||||
signals:
|
||||
void showMessage(MessageDialogType,const QString&,const QString&);
|
||||
|
||||
private:
|
||||
QString m_connection;
|
||||
QString m_attributeTable;
|
||||
AttributeGroup m_attributeGroup;
|
||||
ModelAttributeGroup m_modelAttributeGroup;
|
||||
|
||||
QTableView* m_tableView;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef DATASYNCMANAGER_H
|
||||
#define DATASYNCMANAGER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QHash>
|
||||
#include "global.h"
|
||||
|
||||
class DataSyncManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static DataSyncManager& instance();
|
||||
|
||||
void registerPublicGroup(const QString&); //注册公共属性组
|
||||
AttributeGroup getGroup(int);
|
||||
void syncGroupVersion(int, int);
|
||||
int getGropuVersion(int);//获取属性组的版本号
|
||||
|
||||
private:
|
||||
explicit DataSyncManager();
|
||||
~DataSyncManager();
|
||||
|
||||
QHash<int, AttributeGroup> m_publicGroups;
|
||||
};
|
||||
|
||||
#endif //DATASYNCMANAGER_H
|
||||
|
|
@ -24,6 +24,7 @@ public:
|
|||
void setMainWindow(MainWindow*);
|
||||
void addTab_attribute(const QString&, ModelAttributeGroup&);
|
||||
void closeTab_attribute(ModelAttributeGroup&);
|
||||
void closeAllTab_attribute();
|
||||
|
||||
private slots:
|
||||
void onTabCloseRequested(int);
|
||||
|
|
@ -37,12 +38,19 @@ private slots:
|
|||
void onBtnClicked_cancleChanges();
|
||||
void onBtnClicked_refreshData();
|
||||
|
||||
void onBtnClicked_firstPage();
|
||||
void onBtnClicked_previousPage();
|
||||
void onBtnClicked_nextPage();
|
||||
void onBtnClicked_lastPage();
|
||||
void onEditingFinished_page();
|
||||
|
||||
private:
|
||||
int tabIndex(const QString&);
|
||||
|
||||
Ui::DatabaseBrowser *ui;
|
||||
MainWindow* m_pMainWindow;
|
||||
QList<AttributeView> m_attributeViewList;
|
||||
int m_previousTabIndex;
|
||||
};
|
||||
|
||||
#endif //DBBROWSER_H
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ signals:
|
|||
void actionTrigger_addGroup(int);
|
||||
void openAttributeInfo(const QString&, ModelAttributeGroup&);
|
||||
void closeAttributeInfo(ModelAttributeGroup&);
|
||||
void closeAllAttributeInfo();
|
||||
|
||||
private slots:
|
||||
void itemDoubleClick(const QModelIndex&);
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ struct AttributeGroup
|
|||
QString type; //英文标识名称
|
||||
QString remark;
|
||||
bool isPublic;
|
||||
int version; //用来及记录pucblic类型属性组数据同步的标记
|
||||
|
||||
AttributeGroup()
|
||||
{
|
||||
|
|
@ -53,15 +54,17 @@ struct AttributeGroup
|
|||
type = "";
|
||||
remark = "";
|
||||
isPublic = false;
|
||||
version = 0;
|
||||
}
|
||||
|
||||
//利用移动语义优化的构造函数(不定义也可以,QString实际上实现了隐式共享)
|
||||
AttributeGroup(int id, QString name, QString type, QString remark, bool isPublic)
|
||||
AttributeGroup(int id, QString name, QString type, QString remark, bool isPublic, int version = 0)
|
||||
: id(id),
|
||||
name(std::move(name)),
|
||||
type(std::move(type)),
|
||||
remark(std::move(remark)),
|
||||
isPublic(isPublic){}
|
||||
isPublic(isPublic),
|
||||
version(version){}
|
||||
};
|
||||
|
||||
struct Model
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ private slots:
|
|||
void onSIG_addGroups(int, QVector<int>);
|
||||
void onSIG_openAttributeInfo(const QString&, ModelAttributeGroup&);
|
||||
void onSIG_closeAttributeInfo(ModelAttributeGroup&);
|
||||
void onSIG_closeAllAttributeInfo();
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<RCC>
|
||||
<qresource prefix="img">
|
||||
<file>images/icon_hierarchy_unchecked.png</file>
|
||||
<file>images/icon_hierarchy_disable.png</file>
|
||||
<file>images/icon_search_white.png</file>
|
||||
<file>images/icon_search.png</file>
|
||||
<file>images/icon_refresh3_disable.png</file>
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 221 B |
Binary file not shown.
|
After Width: | Height: | Size: 213 B |
|
|
@ -146,7 +146,7 @@ bool AttributeTableModel::setData(const QModelIndex &index, const QVariant &valu
|
|||
m_currentPageData[row] = modifiedRow;
|
||||
|
||||
emit dataChanged(index, index, {role, Qt::UserRole + AttributeEidt::EditStatus});
|
||||
emit syncDataStatus(m_modifiedRows.isEmpty(), m_paginationInfo);
|
||||
emit syncDataStatus(dataHasbeenModified(), m_paginationInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -408,13 +408,16 @@ int AttributeTableModel::pageSize() const
|
|||
return m_paginationInfo.entriesPerPage;
|
||||
}
|
||||
|
||||
void AttributeTableModel::setCurrentPage(int page)
|
||||
bool AttributeTableModel::setCurrentPage(int page)
|
||||
{
|
||||
if(m_paginationInfo.currentPage != page && page > 0 && page <= totalPages())
|
||||
{
|
||||
m_paginationInfo.currentPage = page;
|
||||
refresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
int AttributeTableModel::currentPage() const
|
||||
{
|
||||
|
|
@ -492,10 +495,10 @@ QList<AttributeTableModel::RowData> AttributeTableModel::filterRowsByEditState(E
|
|||
|
||||
void AttributeTableModel::refresh()
|
||||
{
|
||||
if(!m_modifiedRows.isEmpty())
|
||||
if(dataHasbeenModified())
|
||||
{
|
||||
emit showMessage(type_question, QString::fromWCharArray(L"提示"),
|
||||
QString::fromWCharArray(L"有编辑数据还未提交,确认刷新放弃提交吗?"));
|
||||
QString::fromWCharArray(L"有编辑数据还未提交,确认要放弃吗?"));
|
||||
if(g_msgDlgBtn == btn_No)
|
||||
return;
|
||||
}
|
||||
|
|
@ -503,7 +506,15 @@ void AttributeTableModel::refresh()
|
|||
m_modifiedRows.clear();
|
||||
loadPageData();
|
||||
updateTotalCount();
|
||||
emit syncDataStatus(m_modifiedRows.isEmpty(), m_paginationInfo);
|
||||
emit syncDataStatus(dataHasbeenModified(), m_paginationInfo);
|
||||
}
|
||||
|
||||
void AttributeTableModel::forceRefresh()
|
||||
{
|
||||
m_modifiedRows.clear();
|
||||
loadPageData();
|
||||
updateTotalCount();
|
||||
emit syncDataStatus(dataHasbeenModified(), m_paginationInfo);
|
||||
}
|
||||
|
||||
void AttributeTableModel::insertRecord(int row)
|
||||
|
|
@ -643,16 +654,16 @@ void AttributeTableModel::submitChanges()
|
|||
|
||||
void AttributeTableModel::cancleChanges()
|
||||
{
|
||||
if(m_modifiedRows.isEmpty())
|
||||
if(!dataHasbeenModified())
|
||||
return;
|
||||
|
||||
m_modifiedRows.clear();
|
||||
loadPageData();
|
||||
updateTotalCount();
|
||||
emit syncDataStatus(m_modifiedRows.isEmpty(), m_paginationInfo);
|
||||
emit syncDataStatus(dataHasbeenModified(), m_paginationInfo);
|
||||
}
|
||||
|
||||
void AttributeTableModel::triggerSyncSignal()
|
||||
{
|
||||
emit syncDataStatus(m_modifiedRows.isEmpty(), m_paginationInfo);
|
||||
emit syncDataStatus(dataHasbeenModified(), m_paginationInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
#include "attributeView.h"
|
||||
#include "attributeTableDelegate.h"
|
||||
#include "multiLineHeaderView.h"
|
||||
//#include "sqlQueryExecutor.h"
|
||||
#include "dataSyncManager.h"
|
||||
#include <QHeaderView>
|
||||
#include <QVBoxLayout>
|
||||
#include <QTimer>
|
||||
|
|
@ -11,6 +13,9 @@ AttributeView::AttributeView(const ModelAttributeGroup& modelAttributeGroup, QWi
|
|||
, m_attributeTable(tableName)
|
||||
, m_modelAttributeGroup(modelAttributeGroup)
|
||||
{
|
||||
//需要进行数据同步,因此从PublicGroupSyncManager中统一获取数据
|
||||
m_attributeGroup = DataSyncManager::instance().getGroup(m_modelAttributeGroup.groupID);
|
||||
|
||||
m_tableView = new QTableView(this);
|
||||
m_tableView->setStyleSheet("QTableView::item{padding-left:5px;} QTableView::item:selected{border:1px solid rgb(70,130,180);}");
|
||||
m_tableView->verticalHeader()->setVisible(false);
|
||||
|
|
@ -57,5 +62,24 @@ AttributeView::~AttributeView()
|
|||
|
||||
void AttributeView::active()
|
||||
{
|
||||
if(m_attributeGroup.isPublic && m_attributeGroup.version != DataSyncManager::instance().getGropuVersion(m_attributeGroup.id))
|
||||
{
|
||||
//提示强制刷新
|
||||
emit showMessage(type_information, QString::fromWCharArray(L"提示"),
|
||||
QString::fromWCharArray(L"该属性组为公共组,检测到数据发生更新,需要进行强制刷新"));
|
||||
|
||||
m_attributeTableModel->forceRefresh();
|
||||
m_attributeGroup.version = DataSyncManager::instance().getGropuVersion(m_attributeGroup.id);
|
||||
}
|
||||
else
|
||||
m_attributeTableModel->triggerSyncSignal();
|
||||
}
|
||||
|
||||
void AttributeView::syncChangeRecord()
|
||||
{
|
||||
if(m_attributeGroup.isPublic)
|
||||
{
|
||||
m_attributeGroup.version++;
|
||||
DataSyncManager::instance().syncGroupVersion(m_attributeGroup.id, m_attributeGroup.version);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
#include "dataSyncManager.h"
|
||||
#include "sqlQueryExecutor.h"
|
||||
|
||||
DataSyncManager& DataSyncManager::instance()
|
||||
{
|
||||
//采用静态局部变量的方式,静态局部变量的初始化是在第一次访问时,以后的调用不会多次初始化,并且生命周期和程序一致
|
||||
static DataSyncManager instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
DataSyncManager::DataSyncManager()
|
||||
{
|
||||
}
|
||||
DataSyncManager::~DataSyncManager()
|
||||
{}
|
||||
|
||||
|
||||
void DataSyncManager::registerPublicGroup(const QString& connection)
|
||||
{
|
||||
m_publicGroups.clear();
|
||||
const QVector<AttributeGroup> groups = SqlQueryExecutor::instance().getAttributeGroup(connection);
|
||||
for(const AttributeGroup& group : groups)
|
||||
{
|
||||
if(group.isPublic)
|
||||
m_publicGroups.insert(group.id, group);
|
||||
}
|
||||
}
|
||||
|
||||
AttributeGroup DataSyncManager::getGroup(int groupID)
|
||||
{
|
||||
AttributeGroup group ;
|
||||
if(m_publicGroups.contains(groupID))
|
||||
group = m_publicGroups.value(groupID);
|
||||
return group;
|
||||
}
|
||||
|
||||
void DataSyncManager::syncGroupVersion(int groupID, int version)
|
||||
{
|
||||
if(m_publicGroups.contains(groupID))
|
||||
m_publicGroups[groupID].version = version;
|
||||
}
|
||||
|
||||
int DataSyncManager::getGropuVersion(int groupID)
|
||||
{
|
||||
int version = 0;
|
||||
if(m_publicGroups.contains(groupID))
|
||||
version = m_publicGroups.value(groupID).version;
|
||||
return version;
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
#include "mainwindow.h"
|
||||
#include "attributeView.h"
|
||||
#include <QTabBar>
|
||||
#include <QRegularExpressionValidator>
|
||||
|
||||
DatabaseBrowser::DatabaseBrowser(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
|
|
@ -10,6 +11,12 @@ DatabaseBrowser::DatabaseBrowser(QWidget *parent)
|
|||
, m_pMainWindow(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
m_previousTabIndex = -1;
|
||||
|
||||
//正则表达式,只能输入数字
|
||||
QRegularExpression regExp("[0-9]+");
|
||||
QRegularExpressionValidator* validator = new QRegularExpressionValidator(regExp, this);
|
||||
ui->lineEditPage->setValidator(validator);
|
||||
|
||||
connect(ui->tabWidget, &QTabWidget::tabCloseRequested, this, &DatabaseBrowser::onTabCloseRequested);
|
||||
connect(ui->tabWidget, &QTabWidget::currentChanged, this, &DatabaseBrowser::onCurrentTabChanged);
|
||||
|
|
@ -19,6 +26,13 @@ DatabaseBrowser::DatabaseBrowser(QWidget *parent)
|
|||
connect(ui->btnSave, &QPushButton::clicked, this, &DatabaseBrowser::onBtnClicked_submitChanges);
|
||||
connect(ui->btnCancle, &QPushButton::clicked, this, &DatabaseBrowser::onBtnClicked_cancleChanges);
|
||||
connect(ui->btnRefresh, &QPushButton::clicked, this, &DatabaseBrowser::onBtnClicked_refreshData);
|
||||
|
||||
connect(ui->btnFirstPage, &QPushButton::clicked, this, &DatabaseBrowser::onBtnClicked_firstPage);
|
||||
connect(ui->btnPreviousPage, &QPushButton::clicked, this, &DatabaseBrowser::onBtnClicked_previousPage);
|
||||
connect(ui->btnNextPage, &QPushButton::clicked, this, &DatabaseBrowser::onBtnClicked_nextPage);
|
||||
connect(ui->btnLastPage, &QPushButton::clicked, this, &DatabaseBrowser::onBtnClicked_lastPage);
|
||||
|
||||
connect(ui->lineEditPage, &QLineEdit::returnPressed, this, &DatabaseBrowser::onEditingFinished_page);
|
||||
}
|
||||
|
||||
DatabaseBrowser::~DatabaseBrowser()
|
||||
|
|
@ -53,6 +67,7 @@ void DatabaseBrowser::addTab_attribute(const QString& connection, ModelAttribute
|
|||
}
|
||||
|
||||
AttributeView* view = new AttributeView(attributeGroup, ui->tabWidget, connection);
|
||||
connect(view, &AttributeView::showMessage, this, &DatabaseBrowser::onShowMessage);
|
||||
connect(view->model(), &AttributeTableModel::showMessage, this, &DatabaseBrowser::onShowMessage);
|
||||
connect(view->model(), &AttributeTableModel::syncDataStatus, this, &DatabaseBrowser::onSyncDataStatus);
|
||||
connect(view->delegate(), &AttributeTableDelegate::showMessage, this, &DatabaseBrowser::onShowMessage);
|
||||
|
|
@ -90,6 +105,13 @@ void DatabaseBrowser::closeTab_attribute(ModelAttributeGroup& attributeGroup)
|
|||
onTabCloseRequested(index);
|
||||
}
|
||||
|
||||
void DatabaseBrowser::closeAllTab_attribute()
|
||||
{
|
||||
int tabCount = ui->tabWidget->count();
|
||||
for(int index = 0; index < tabCount; index++)
|
||||
onTabCloseRequested(0);
|
||||
}
|
||||
|
||||
void DatabaseBrowser::onTabCloseRequested(int index)
|
||||
{
|
||||
/*QObject* sender = QObject::sender();
|
||||
|
|
@ -105,6 +127,12 @@ void DatabaseBrowser::onTabCloseRequested(int index)
|
|||
|
||||
void DatabaseBrowser::onCurrentTabChanged(int index)
|
||||
{
|
||||
if(m_previousTabIndex != -1)
|
||||
{
|
||||
ui->tabWidget->setTabIcon(m_previousTabIndex, QIcon(":/img/images/icon_hierarchy_unchecked.png"));
|
||||
}
|
||||
m_previousTabIndex = index;
|
||||
|
||||
if(index == -1) //最后一个tab关闭时会触发
|
||||
{
|
||||
ui->btnAdd->setEnabled(false);
|
||||
|
|
@ -114,11 +142,12 @@ void DatabaseBrowser::onCurrentTabChanged(int index)
|
|||
ui->btnSave->setEnabled(false);
|
||||
ui->btnCancle->setEnabled(false);
|
||||
ui->recordInfo->clear();
|
||||
ui->lineEdit->setEnabled(false);
|
||||
ui->lineEdit->setText("1");
|
||||
ui->lineEditPage->setEnabled(false);
|
||||
ui->lineEditPage->setText("1");
|
||||
return;
|
||||
}
|
||||
|
||||
ui->tabWidget->setTabIcon(m_previousTabIndex, QIcon(":/img/images/icon_hierarchy.png"));
|
||||
QWidget* widget = ui->tabWidget->widget(index);
|
||||
AttributeView* attributeView = qobject_cast<AttributeView*>(widget);
|
||||
if(attributeView)
|
||||
|
|
@ -183,7 +212,10 @@ void DatabaseBrowser::onBtnClicked_submitChanges()
|
|||
QTableView* view = attributeView->view();
|
||||
AttributeTableModel* model = attributeView->model();
|
||||
if(view && model)
|
||||
{
|
||||
model->submitChanges();
|
||||
attributeView->syncChangeRecord();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -213,15 +245,84 @@ void DatabaseBrowser::onBtnClicked_refreshData()
|
|||
}
|
||||
}
|
||||
|
||||
void DatabaseBrowser::onBtnClicked_firstPage()
|
||||
{
|
||||
QWidget* widget = ui->tabWidget->currentWidget();
|
||||
AttributeView* attributeView = qobject_cast<AttributeView*>(widget);
|
||||
if(attributeView)
|
||||
{
|
||||
QTableView* view = attributeView->view();
|
||||
AttributeTableModel* model = attributeView->model();
|
||||
if(view && model)
|
||||
model->firstPage();
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseBrowser::onBtnClicked_previousPage()
|
||||
{
|
||||
QWidget* widget = ui->tabWidget->currentWidget();
|
||||
AttributeView* attributeView = qobject_cast<AttributeView*>(widget);
|
||||
if(attributeView)
|
||||
{
|
||||
QTableView* view = attributeView->view();
|
||||
AttributeTableModel* model = attributeView->model();
|
||||
if(view && model)
|
||||
model->previousPage();
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseBrowser::onBtnClicked_nextPage()
|
||||
{
|
||||
QWidget* widget = ui->tabWidget->currentWidget();
|
||||
AttributeView* attributeView = qobject_cast<AttributeView*>(widget);
|
||||
if(attributeView)
|
||||
{
|
||||
QTableView* view = attributeView->view();
|
||||
AttributeTableModel* model = attributeView->model();
|
||||
if(view && model)
|
||||
model->nextPage();
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseBrowser::onBtnClicked_lastPage()
|
||||
{
|
||||
QWidget* widget = ui->tabWidget->currentWidget();
|
||||
AttributeView* attributeView = qobject_cast<AttributeView*>(widget);
|
||||
if(attributeView)
|
||||
{
|
||||
QTableView* view = attributeView->view();
|
||||
AttributeTableModel* model = attributeView->model();
|
||||
if(view && model)
|
||||
model->lastPage();
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseBrowser::onEditingFinished_page()
|
||||
{
|
||||
QWidget* widget = ui->tabWidget->currentWidget();
|
||||
AttributeView* attributeView = qobject_cast<AttributeView*>(widget);
|
||||
if(attributeView)
|
||||
{
|
||||
QTableView* view = attributeView->view();
|
||||
AttributeTableModel* model = attributeView->model();
|
||||
if(view && model)
|
||||
{
|
||||
QString strPage = ui->lineEditPage->text();
|
||||
model->setCurrentPage(strPage.toInt());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseBrowser::onSyncDataStatus(bool hasModifiedData, const PaginationInfo& paginationInfo)
|
||||
{
|
||||
ui->btnSave->setEnabled(!hasModifiedData);
|
||||
ui->btnCancle->setEnabled(!hasModifiedData);
|
||||
ui->btnSave->setEnabled(hasModifiedData);
|
||||
ui->btnCancle->setEnabled(hasModifiedData);
|
||||
|
||||
QString recordInfo = QString::fromWCharArray(L"共 %1 条记录").arg(paginationInfo.totalEntries);
|
||||
ui->recordInfo->setText(recordInfo);
|
||||
ui->lineEdit->setText(QString::number(paginationInfo.currentPage));
|
||||
ui->lineEdit->setEnabled(true);
|
||||
ui->lineEditPage->setText(QString::number(paginationInfo.currentPage));
|
||||
ui->lineEditPage->setEnabled(true);
|
||||
}
|
||||
|
||||
void DatabaseBrowser::onShowMessage(MessageDialogType type,const QString& strTitle,const QString& strContent)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "mainwindow.h"
|
||||
#include "dbManager.h"
|
||||
#include "customMenu.h"
|
||||
#include "dataSyncManager.h"
|
||||
#include <QMenu>
|
||||
#include <QPoint>
|
||||
#include <QMouseEvent>
|
||||
|
|
@ -65,7 +66,10 @@ void DBStructureView::connectToDB(const QString& connName)
|
|||
{
|
||||
bool bResutl = m_dbManager->connect(connName);
|
||||
if(bResutl)
|
||||
{
|
||||
model->refreshStructure_Connection(connName);
|
||||
DataSyncManager::instance().registerPublicGroup(connName);
|
||||
}
|
||||
|
||||
/*QModelIndex index = model->getConnNodeIndex(connName);
|
||||
if(index.isValid())
|
||||
|
|
@ -86,6 +90,8 @@ void DBStructureView::disconnectToDB(const QString& connName)
|
|||
QModelIndex index = model->getConnNodeIndex(connName);
|
||||
if(index.isValid())
|
||||
collapse(index);
|
||||
|
||||
emit closeAllAttributeInfo();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ void MainWindow::initialize()
|
|||
connect(m_pDBStrutureView, &DBStructureView::actionTrigger_addGroup, this, &MainWindow::onActionTrigger_addGroup);
|
||||
connect(m_pDBStrutureView, &DBStructureView::openAttributeInfo, this, &MainWindow::onSIG_openAttributeInfo);
|
||||
connect(m_pDBStrutureView, &DBStructureView::closeAttributeInfo, this, &MainWindow::onSIG_closeAttributeInfo);
|
||||
connect(m_pDBStrutureView, &DBStructureView::closeAllAttributeInfo, this, &MainWindow::onSIG_closeAllAttributeInfo);
|
||||
ui->layoutDBStructure->addWidget(m_pDBStrutureView);
|
||||
m_pDBStrutureModel = new DBStructureModel(this);
|
||||
m_pDBStrutureModel->setMainWindow(this);
|
||||
|
|
@ -297,3 +298,9 @@ void MainWindow::onSIG_closeAttributeInfo(ModelAttributeGroup& attributeGroup)
|
|||
if(m_dbBrowser)
|
||||
m_dbBrowser->closeTab_attribute(attributeGroup);
|
||||
}
|
||||
|
||||
void MainWindow::onSIG_closeAllAttributeInfo()
|
||||
{
|
||||
if(m_dbBrowser)
|
||||
m_dbBrowser->closeAllTab_attribute();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,14 @@ void MessageDialog::setMessage(MessageDialogType type,const QString& strTitle,co
|
|||
setType(type);
|
||||
ui->labelTitle->setText(strTitle);
|
||||
setWindowTitle(strTitle);
|
||||
if(strContent.length() > 19)
|
||||
{
|
||||
//QString& strText = const_cast<QString&>(strContent);
|
||||
QString strText(strContent);
|
||||
strText.insert(19, "\n"); //实现简单自动换行
|
||||
ui->labelContent->setText(strText);
|
||||
}
|
||||
else
|
||||
ui->labelContent->setText(strContent);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ void ModelInfoEditDialog::initialize()
|
|||
m_curModelID = -1;
|
||||
ui->btnAddGroup->setVisible(false);
|
||||
m_pMaskLayer = new MaskLayer(this);
|
||||
//正则表达式,只能属于字母
|
||||
//正则表达式,只能输入字母
|
||||
QRegularExpression regExp("[A-Za-z0-9]+");
|
||||
QRegularExpressionValidator* validator = new QRegularExpressionValidator(regExp, this);
|
||||
ui->lineEdit_modelType->setValidator(validator);
|
||||
|
|
|
|||
|
|
@ -56,20 +56,7 @@ border-radius:3px;
|
|||
}
|
||||
</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_type">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>10</y>
|
||||
<width>61</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>属性类别:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_type">
|
||||
<widget class="QLineEdit" name="lineEdit_name">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
|
|
@ -79,20 +66,10 @@ border-radius:3px;
|
|||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_name">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>280</x>
|
||||
<y>8</y>
|
||||
<width>113</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_name">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<x>20</x>
|
||||
<y>10</y>
|
||||
<width>61</width>
|
||||
<height>16</height>
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ QPushButton:pressed
|
|||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<widget class="QLineEdit" name="lineEdit">
|
||||
<widget class="QLineEdit" name="lineEditPage">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
|
|
|||
|
|
@ -55,23 +55,24 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>23</y>
|
||||
<y>15</y>
|
||||
<width>261</width>
|
||||
<height>20</height>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font: 10pt;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>该类型已存在,是否读取数据载入详细数据</string>
|
||||
<string>该属性组为公共组,检测到数据发生更新,
|
||||
需要进行强制刷新</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>50</y>
|
||||
<y>53</y>
|
||||
<width>211</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
|
|
@ -178,7 +179,7 @@ background-color:rgb(67,160,249);
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>15</y>
|
||||
<y>18</y>
|
||||
<width>36</width>
|
||||
<height>36</height>
|
||||
</rect>
|
||||
|
|
|
|||
Loading…
Reference in New Issue