元数据页面风格调整
This commit is contained in:
parent
3e05ecd9d2
commit
5f3a8cc8dd
|
|
@ -2,18 +2,46 @@
|
||||||
#include "src/utils/uf2configreader.h"
|
#include "src/utils/uf2configreader.h"
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QTableWidgetItem>
|
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
|
#include <QStandardItem>
|
||||||
|
#include <QStyledItemDelegate>
|
||||||
|
#include <QPainter>
|
||||||
#include "src/utils/logmanager.h"
|
#include "src/utils/logmanager.h"
|
||||||
#include "ElaPushButton.h"
|
#include "ElaPushButton.h"
|
||||||
|
#include "ElaProgressBar.h"
|
||||||
|
#include "ElaText.h"
|
||||||
|
|
||||||
|
class StatusDelegate : public QStyledItemDelegate
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit StatusDelegate(QObject *parent = nullptr) : QStyledItemDelegate(parent) {}
|
||||||
|
|
||||||
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
|
||||||
|
{
|
||||||
|
QVariant bgColor = index.data(Qt::BackgroundRole);
|
||||||
|
QVariant fgColor = index.data(Qt::ForegroundRole);
|
||||||
|
|
||||||
|
QStyleOptionViewItem opt = option;
|
||||||
|
initStyleOption(&opt, index);
|
||||||
|
|
||||||
|
if (bgColor.canConvert<QBrush>()) {
|
||||||
|
painter->fillRect(opt.rect, bgColor.value<QBrush>());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fgColor.canConvert<QBrush>()) {
|
||||||
|
painter->setPen(fgColor.value<QBrush>().color());
|
||||||
|
}
|
||||||
|
|
||||||
|
painter->drawText(opt.rect, opt.displayAlignment, opt.text);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
BatchConvertPage::BatchConvertPage(QWidget *parent)
|
BatchConvertPage::BatchConvertPage(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
|
|
@ -36,9 +64,12 @@ void BatchConvertPage::initUI()
|
||||||
QVBoxLayout *funcLayout = new QVBoxLayout(funcBox);
|
QVBoxLayout *funcLayout = new QVBoxLayout(funcBox);
|
||||||
funcLayout->setSpacing(10);
|
funcLayout->setSpacing(10);
|
||||||
|
|
||||||
m_funcTable = new QTableWidget;
|
m_tableModel = new QStandardItemModel(this);
|
||||||
m_funcTable->setColumnCount(3);
|
m_tableModel->setColumnCount(3);
|
||||||
m_funcTable->setHorizontalHeaderLabels({"UF20函数名", "是否存在", "操作"});
|
m_tableModel->setHorizontalHeaderLabels({"UF20函数名", "是否存在", "操作"});
|
||||||
|
|
||||||
|
m_funcTable = new ElaTableView;
|
||||||
|
m_funcTable->setModel(m_tableModel);
|
||||||
m_funcTable->setMinimumHeight(200);
|
m_funcTable->setMinimumHeight(200);
|
||||||
m_funcTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
m_funcTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
m_funcTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed);
|
m_funcTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed);
|
||||||
|
|
@ -46,6 +77,7 @@ void BatchConvertPage::initUI()
|
||||||
m_funcTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Fixed);
|
m_funcTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Fixed);
|
||||||
m_funcTable->horizontalHeader()->setStretchLastSection(false);
|
m_funcTable->horizontalHeader()->setStretchLastSection(false);
|
||||||
m_funcTable->setColumnWidth(2, 80);
|
m_funcTable->setColumnWidth(2, 80);
|
||||||
|
m_funcTable->setItemDelegateForColumn(1, new StatusDelegate(this));
|
||||||
funcLayout->addWidget(m_funcTable);
|
funcLayout->addWidget(m_funcTable);
|
||||||
|
|
||||||
QHBoxLayout *tableBtnLayout = new QHBoxLayout;
|
QHBoxLayout *tableBtnLayout = new QHBoxLayout;
|
||||||
|
|
@ -68,30 +100,18 @@ void BatchConvertPage::initUI()
|
||||||
QVBoxLayout *progressLayout = new QVBoxLayout(progressBox);
|
QVBoxLayout *progressLayout = new QVBoxLayout(progressBox);
|
||||||
progressLayout->setSpacing(10);
|
progressLayout->setSpacing(10);
|
||||||
|
|
||||||
m_progressLabel = new QLabel("等待开始...");
|
m_progressLabel = new ElaText("等待开始...");
|
||||||
m_progressLabel->setStyleSheet("color: #666;");
|
m_progressLabel->setStyleSheet("color: #666; font-size: 12px;");
|
||||||
m_progressLabel->setFixedHeight(20);
|
m_progressLabel->setFixedHeight(40);
|
||||||
m_progressLabel->setWordWrap(false);
|
m_progressLabel->setWordWrap(false);
|
||||||
m_progressLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
m_progressLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
progressLayout->addWidget(m_progressLabel);
|
progressLayout->addWidget(m_progressLabel);
|
||||||
|
|
||||||
m_progressBar = new QProgressBar;
|
m_progressBar = new ElaProgressBar;
|
||||||
m_progressBar->setRange(0, 100);
|
m_progressBar->setRange(0, 100);
|
||||||
m_progressBar->setValue(0);
|
m_progressBar->setValue(0);
|
||||||
m_progressBar->setFixedHeight(25);
|
m_progressBar->setFixedHeight(25);
|
||||||
m_progressBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
m_progressBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
m_progressBar->setStyleSheet(R"(
|
|
||||||
QProgressBar {
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
border-radius: 4px;
|
|
||||||
background-color: #f0f0f0;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
QProgressBar::chunk {
|
|
||||||
background-color: #1abc9c;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
)");
|
|
||||||
progressLayout->addWidget(m_progressBar);
|
progressLayout->addWidget(m_progressBar);
|
||||||
|
|
||||||
layout->addWidget(progressBox);
|
layout->addWidget(progressBox);
|
||||||
|
|
@ -122,30 +142,37 @@ bool BatchConvertPage::checkFunctionExists(const QString &funcName)
|
||||||
|
|
||||||
void BatchConvertPage::updateTable()
|
void BatchConvertPage::updateTable()
|
||||||
{
|
{
|
||||||
m_funcTable->setRowCount(m_funcList.size());
|
m_tableModel->removeRows(0, m_tableModel->rowCount());
|
||||||
|
|
||||||
for (int i = 0; i < m_funcList.size(); ++i) {
|
for (int i = 0; i < m_funcList.size(); ++i) {
|
||||||
QString funcName = m_funcList[i];
|
QString funcName = m_funcList[i];
|
||||||
|
|
||||||
QTableWidgetItem *nameItem = new QTableWidgetItem(funcName);
|
QStandardItem *nameItem = new QStandardItem(funcName);
|
||||||
nameItem->setFlags(nameItem->flags() & ~Qt::ItemIsEditable);
|
nameItem->setFlags(nameItem->flags() & ~Qt::ItemIsEditable);
|
||||||
m_funcTable->setItem(i, 0, nameItem);
|
|
||||||
|
|
||||||
bool exists = checkFunctionExists(funcName);
|
bool exists = checkFunctionExists(funcName);
|
||||||
QString statusText = exists ? "是" : "否";
|
QString statusText = exists ? "是" : "否";
|
||||||
|
|
||||||
QTableWidgetItem *statusItem = new QTableWidgetItem(statusText);
|
QStandardItem *statusItem = new QStandardItem(statusText);
|
||||||
statusItem->setFlags(statusItem->flags() & ~Qt::ItemIsEditable);
|
statusItem->setFlags(statusItem->flags() & ~Qt::ItemIsEditable);
|
||||||
statusItem->setTextAlignment(Qt::AlignCenter);
|
statusItem->setTextAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
if (exists) {
|
if (exists) {
|
||||||
statusItem->setBackground(QColor(144, 238, 144));
|
statusItem->setData(QBrush(QColor(144, 238, 144)), Qt::BackgroundRole);
|
||||||
statusItem->setForeground(QColor(0, 100, 0));
|
statusItem->setData(QBrush(QColor(0, 100, 0)), Qt::ForegroundRole);
|
||||||
} else {
|
} else {
|
||||||
statusItem->setBackground(QColor(255, 182, 193));
|
statusItem->setData(QBrush(QColor(255, 182, 193)), Qt::BackgroundRole);
|
||||||
statusItem->setForeground(QColor(139, 0, 0));
|
statusItem->setData(QBrush(QColor(139, 0, 0)), Qt::ForegroundRole);
|
||||||
}
|
}
|
||||||
m_funcTable->setItem(i, 1, statusItem);
|
|
||||||
|
QStandardItem *actionItem = new QStandardItem("");
|
||||||
|
actionItem->setFlags(actionItem->flags() & ~Qt::ItemIsEditable);
|
||||||
|
|
||||||
|
QList<QStandardItem*> rowItems;
|
||||||
|
rowItems.append(nameItem);
|
||||||
|
rowItems.append(statusItem);
|
||||||
|
rowItems.append(actionItem);
|
||||||
|
m_tableModel->appendRow(rowItems);
|
||||||
|
|
||||||
QPushButton *editBtn = new QPushButton;
|
QPushButton *editBtn = new QPushButton;
|
||||||
editBtn->setIcon(QIcon(":/resources/images/bianji.png"));
|
editBtn->setIcon(QIcon(":/resources/images/bianji.png"));
|
||||||
|
|
@ -155,10 +182,10 @@ void BatchConvertPage::updateTable()
|
||||||
connect(editBtn, &QPushButton::clicked, this, [this, i]() {
|
connect(editBtn, &QPushButton::clicked, this, [this, i]() {
|
||||||
onEditRow(i);
|
onEditRow(i);
|
||||||
});
|
});
|
||||||
m_funcTable->setCellWidget(i, 2, editBtn);
|
m_funcTable->setIndexWidget(m_tableModel->index(i, 2), editBtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
int totalWidth = m_funcTable->width();
|
int totalWidth = m_funcTable->viewport()->width();
|
||||||
m_funcTable->setColumnWidth(0, (totalWidth - 80) * 8 / 10);
|
m_funcTable->setColumnWidth(0, (totalWidth - 80) * 8 / 10);
|
||||||
m_funcTable->setColumnWidth(1, (totalWidth - 80) * 2 / 10);
|
m_funcTable->setColumnWidth(1, (totalWidth - 80) * 2 / 10);
|
||||||
m_funcTable->setColumnWidth(2, 80);
|
m_funcTable->setColumnWidth(2, 80);
|
||||||
|
|
@ -280,15 +307,15 @@ void BatchConvertPage::onAddFunction()
|
||||||
|
|
||||||
void BatchConvertPage::onRemoveFunction()
|
void BatchConvertPage::onRemoveFunction()
|
||||||
{
|
{
|
||||||
QList<QTableWidgetItem*> selectedItems = m_funcTable->selectedItems();
|
QModelIndexList selectedIndexes = m_funcTable->selectionModel()->selectedRows();
|
||||||
if (selectedItems.isEmpty()) {
|
if (selectedIndexes.isEmpty()) {
|
||||||
QMessageBox::warning(this, "提示", "请先选中要删除的行!");
|
QMessageBox::warning(this, "提示", "请先选中要删除的行!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<int> rowsToRemove;
|
QList<int> rowsToRemove;
|
||||||
for (QTableWidgetItem *item : selectedItems) {
|
for (const QModelIndex &index : selectedIndexes) {
|
||||||
int row = item->row();
|
int row = index.row();
|
||||||
if (!rowsToRemove.contains(row)) {
|
if (!rowsToRemove.contains(row)) {
|
||||||
rowsToRemove.append(row);
|
rowsToRemove.append(row);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,12 @@
|
||||||
#define BATCHCONVERTPAGE_H
|
#define BATCHCONVERTPAGE_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QTableWidget>
|
#include <QStandardItemModel>
|
||||||
#include <QProgressBar>
|
|
||||||
#include <QLabel>
|
|
||||||
#include "ElaLineEdit.h"
|
#include "ElaLineEdit.h"
|
||||||
#include "ElaPushButton.h"
|
#include "ElaPushButton.h"
|
||||||
|
#include "ElaTableView.h"
|
||||||
|
#include "ElaProgressBar.h"
|
||||||
|
#include "ElaText.h"
|
||||||
|
|
||||||
class BatchConvertPage : public QWidget
|
class BatchConvertPage : public QWidget
|
||||||
{
|
{
|
||||||
|
|
@ -44,10 +45,11 @@ private:
|
||||||
void updateTable();
|
void updateTable();
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
||||||
QTableWidget *m_funcTable;
|
ElaTableView *m_funcTable;
|
||||||
|
QStandardItemModel *m_tableModel;
|
||||||
QStringList m_funcList;
|
QStringList m_funcList;
|
||||||
QProgressBar *m_progressBar;
|
ElaProgressBar *m_progressBar;
|
||||||
QLabel *m_progressLabel;
|
ElaText *m_progressLabel;
|
||||||
ElaPushButton *m_startBtn;
|
ElaPushButton *m_startBtn;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,10 @@
|
||||||
#define FUNCTIONSEARCHPAGE_H
|
#define FUNCTIONSEARCHPAGE_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QTableWidget>
|
#include <QStandardItemModel>
|
||||||
#include "ElaLineEdit.h"
|
#include "ElaLineEdit.h"
|
||||||
#include "ElaPushButton.h"
|
#include "ElaPushButton.h"
|
||||||
|
#include "ElaTableView.h"
|
||||||
|
|
||||||
class FunctionSearchPage : public QWidget
|
class FunctionSearchPage : public QWidget
|
||||||
{
|
{
|
||||||
|
|
@ -18,7 +19,8 @@ private:
|
||||||
void initUI();
|
void initUI();
|
||||||
|
|
||||||
ElaLineEdit *m_searchEdit;
|
ElaLineEdit *m_searchEdit;
|
||||||
QTableWidget *m_resultTable;
|
ElaTableView *m_resultTable;
|
||||||
|
QStandardItemModel *m_tableModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QTableWidgetItem>
|
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QStandardItem>
|
||||||
#include "ElaComboBox.h"
|
#include "ElaComboBox.h"
|
||||||
#include "ElaLineEdit.h"
|
#include "ElaLineEdit.h"
|
||||||
#include "ElaPushButton.h"
|
#include "ElaPushButton.h"
|
||||||
|
|
@ -47,15 +47,18 @@ void UF20FunctionSearchPage::initUI()
|
||||||
searchLayout->addStretch();
|
searchLayout->addStretch();
|
||||||
layout->addLayout(searchLayout);
|
layout->addLayout(searchLayout);
|
||||||
|
|
||||||
m_resultTable = new QTableWidget;
|
m_tableModel = new QStandardItemModel(this);
|
||||||
m_resultTable->setColumnCount(3);
|
m_tableModel->setColumnCount(3);
|
||||||
m_resultTable->setHorizontalHeaderLabels({"功能名称", "英文名", "功能编号"});
|
m_tableModel->setHorizontalHeaderLabels({"功能名称", "英文名", "功能编号"});
|
||||||
|
|
||||||
|
m_resultTable = new ElaTableView;
|
||||||
|
m_resultTable->setModel(m_tableModel);
|
||||||
m_resultTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
m_resultTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||||
m_resultTable->setMinimumHeight(400);
|
m_resultTable->setMinimumHeight(400);
|
||||||
m_resultTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
m_resultTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
m_resultTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
m_resultTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||||
m_resultTable->setSelectionMode(QAbstractItemView::SingleSelection);
|
m_resultTable->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
connect(m_resultTable, &QTableWidget::cellDoubleClicked, this, &UF20FunctionSearchPage::onTableDoubleClicked);
|
connect(m_resultTable, &QTableView::doubleClicked, this, &UF20FunctionSearchPage::onTableDoubleClicked);
|
||||||
layout->addWidget(m_resultTable);
|
layout->addWidget(m_resultTable);
|
||||||
|
|
||||||
QHBoxLayout *tipLayout = new QHBoxLayout;
|
QHBoxLayout *tipLayout = new QHBoxLayout;
|
||||||
|
|
@ -70,7 +73,7 @@ void UF20FunctionSearchPage::onSearch()
|
||||||
{
|
{
|
||||||
QString keyword = m_searchEdit->text().trimmed();
|
QString keyword = m_searchEdit->text().trimmed();
|
||||||
|
|
||||||
m_resultTable->setRowCount(0);
|
m_tableModel->removeRows(0, m_tableModel->rowCount());
|
||||||
|
|
||||||
if (keyword.isEmpty()) {
|
if (keyword.isEmpty()) {
|
||||||
QMessageBox::information(this, "提示", "请输入查询内容");
|
QMessageBox::information(this, "提示", "请输入查询内容");
|
||||||
|
|
@ -85,31 +88,29 @@ void UF20FunctionSearchPage::onSearch()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
for (const FunctionInfo& info : results) {
|
for (const FunctionInfo& info : results) {
|
||||||
m_resultTable->insertRow(row);
|
QList<QStandardItem*> rowItems;
|
||||||
|
|
||||||
QTableWidgetItem *cnameItem = new QTableWidgetItem(info.cname);
|
QStandardItem *cnameItem = new QStandardItem(info.cname);
|
||||||
cnameItem->setFlags(cnameItem->flags() & ~Qt::ItemIsEditable);
|
cnameItem->setFlags(cnameItem->flags() & ~Qt::ItemIsEditable);
|
||||||
m_resultTable->setItem(row, 0, cnameItem);
|
rowItems.append(cnameItem);
|
||||||
|
|
||||||
QTableWidgetItem *eNameItem = new QTableWidgetItem(info.eName);
|
QStandardItem *eNameItem = new QStandardItem(info.eName);
|
||||||
eNameItem->setFlags(eNameItem->flags() & ~Qt::ItemIsEditable);
|
eNameItem->setFlags(eNameItem->flags() & ~Qt::ItemIsEditable);
|
||||||
m_resultTable->setItem(row, 1, eNameItem);
|
rowItems.append(eNameItem);
|
||||||
|
|
||||||
QTableWidgetItem *funcNoItem = new QTableWidgetItem(info.functionNo);
|
QStandardItem *funcNoItem = new QStandardItem(info.functionNo);
|
||||||
funcNoItem->setFlags(funcNoItem->flags() & ~Qt::ItemIsEditable);
|
funcNoItem->setFlags(funcNoItem->flags() & ~Qt::ItemIsEditable);
|
||||||
m_resultTable->setItem(row, 2, funcNoItem);
|
rowItems.append(funcNoItem);
|
||||||
|
|
||||||
row++;
|
m_tableModel->appendRow(rowItems);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UF20FunctionSearchPage::onTableDoubleClicked(int row, int column)
|
void UF20FunctionSearchPage::onTableDoubleClicked(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
QTableWidgetItem *item = m_resultTable->item(row, 0);
|
if (index.isValid()) {
|
||||||
if (item) {
|
QString funcName = m_tableModel->data(m_tableModel->index(index.row(), 0)).toString();
|
||||||
QString funcName = item->text();
|
|
||||||
emit addFunctionToConvert(funcName);
|
emit addFunctionToConvert(funcName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,11 @@
|
||||||
#define UF20FUNCTIONSEARCHPAGE_H
|
#define UF20FUNCTIONSEARCHPAGE_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QTableWidget>
|
#include <QStandardItemModel>
|
||||||
#include "ElaComboBox.h"
|
#include "ElaComboBox.h"
|
||||||
#include "ElaLineEdit.h"
|
#include "ElaLineEdit.h"
|
||||||
#include "ElaPushButton.h"
|
#include "ElaPushButton.h"
|
||||||
|
#include "ElaTableView.h"
|
||||||
|
|
||||||
class UF20FunctionSearchPage : public QWidget
|
class UF20FunctionSearchPage : public QWidget
|
||||||
{
|
{
|
||||||
|
|
@ -20,14 +21,15 @@ signals:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onSearch();
|
void onSearch();
|
||||||
void onTableDoubleClicked(int row, int column);
|
void onTableDoubleClicked(const QModelIndex &index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initUI();
|
void initUI();
|
||||||
|
|
||||||
ElaComboBox *m_searchComboBox;
|
ElaComboBox *m_searchComboBox;
|
||||||
ElaLineEdit *m_searchEdit;
|
ElaLineEdit *m_searchEdit;
|
||||||
QTableWidget *m_resultTable;
|
ElaTableView *m_resultTable;
|
||||||
|
QStandardItemModel *m_tableModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QTableWidgetItem>
|
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QStandardItem>
|
||||||
#include "ElaComboBox.h"
|
#include "ElaComboBox.h"
|
||||||
#include "ElaLineEdit.h"
|
#include "ElaLineEdit.h"
|
||||||
#include "ElaPushButton.h"
|
#include "ElaPushButton.h"
|
||||||
|
|
@ -46,9 +46,12 @@ void UFT3FunctionSearchPage::initUI()
|
||||||
searchLayout->addStretch();
|
searchLayout->addStretch();
|
||||||
layout->addLayout(searchLayout);
|
layout->addLayout(searchLayout);
|
||||||
|
|
||||||
m_resultTable = new QTableWidget;
|
m_tableModel = new QStandardItemModel(this);
|
||||||
m_resultTable->setColumnCount(3);
|
m_tableModel->setColumnCount(3);
|
||||||
m_resultTable->setHorizontalHeaderLabels({"英文名", "功能编号", "功能名称"});
|
m_tableModel->setHorizontalHeaderLabels({"英文名", "功能编号", "功能名称"});
|
||||||
|
|
||||||
|
m_resultTable = new ElaTableView;
|
||||||
|
m_resultTable->setModel(m_tableModel);
|
||||||
m_resultTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
m_resultTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||||
m_resultTable->setMinimumHeight(400);
|
m_resultTable->setMinimumHeight(400);
|
||||||
m_resultTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
m_resultTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
|
|
@ -60,7 +63,7 @@ void UFT3FunctionSearchPage::onSearch()
|
||||||
{
|
{
|
||||||
QString keyword = m_searchEdit->text().trimmed();
|
QString keyword = m_searchEdit->text().trimmed();
|
||||||
|
|
||||||
m_resultTable->setRowCount(0);
|
m_tableModel->removeRows(0, m_tableModel->rowCount());
|
||||||
|
|
||||||
if (keyword.isEmpty()) {
|
if (keyword.isEmpty()) {
|
||||||
QMessageBox::information(this, "提示", "请输入查询内容");
|
QMessageBox::information(this, "提示", "请输入查询内容");
|
||||||
|
|
@ -75,22 +78,21 @@ void UFT3FunctionSearchPage::onSearch()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
for (const FunctionInfo& info : results) {
|
for (const FunctionInfo& info : results) {
|
||||||
m_resultTable->insertRow(row);
|
QList<QStandardItem*> rowItems;
|
||||||
|
|
||||||
QTableWidgetItem *cnameItem = new QTableWidgetItem(info.cname);
|
QStandardItem *cnameItem = new QStandardItem(info.cname);
|
||||||
cnameItem->setFlags(cnameItem->flags() & ~Qt::ItemIsEditable);
|
cnameItem->setFlags(cnameItem->flags() & ~Qt::ItemIsEditable);
|
||||||
m_resultTable->setItem(row, 0, cnameItem);
|
rowItems.append(cnameItem);
|
||||||
|
|
||||||
QTableWidgetItem *eNameItem = new QTableWidgetItem(info.eName);
|
QStandardItem *eNameItem = new QStandardItem(info.eName);
|
||||||
eNameItem->setFlags(eNameItem->flags() & ~Qt::ItemIsEditable);
|
eNameItem->setFlags(eNameItem->flags() & ~Qt::ItemIsEditable);
|
||||||
m_resultTable->setItem(row, 1, eNameItem);
|
rowItems.append(eNameItem);
|
||||||
|
|
||||||
QTableWidgetItem *funcNoItem = new QTableWidgetItem(info.functionNo);
|
QStandardItem *funcNoItem = new QStandardItem(info.functionNo);
|
||||||
funcNoItem->setFlags(funcNoItem->flags() & ~Qt::ItemIsEditable);
|
funcNoItem->setFlags(funcNoItem->flags() & ~Qt::ItemIsEditable);
|
||||||
m_resultTable->setItem(row, 2, funcNoItem);
|
rowItems.append(funcNoItem);
|
||||||
|
|
||||||
row++;
|
m_tableModel->appendRow(rowItems);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,11 @@
|
||||||
#define UFT3FUNCTIONSEARCHPAGE_H
|
#define UFT3FUNCTIONSEARCHPAGE_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QTableWidget>
|
#include <QStandardItemModel>
|
||||||
#include "ElaComboBox.h"
|
#include "ElaComboBox.h"
|
||||||
#include "ElaLineEdit.h"
|
#include "ElaLineEdit.h"
|
||||||
#include "ElaPushButton.h"
|
#include "ElaPushButton.h"
|
||||||
|
#include "ElaTableView.h"
|
||||||
|
|
||||||
class UFT3FunctionSearchPage : public QWidget
|
class UFT3FunctionSearchPage : public QWidget
|
||||||
{
|
{
|
||||||
|
|
@ -23,7 +24,8 @@ private:
|
||||||
|
|
||||||
ElaComboBox *m_searchComboBox;
|
ElaComboBox *m_searchComboBox;
|
||||||
ElaLineEdit *m_searchEdit;
|
ElaLineEdit *m_searchEdit;
|
||||||
QTableWidget *m_resultTable;
|
ElaTableView *m_resultTable;
|
||||||
|
QStandardItemModel *m_tableModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,13 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QLabel>
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QSpacerItem>
|
||||||
|
|
||||||
|
const int UPDATE_ITEM_SHOW_COLUMN_COUNT = 3;
|
||||||
|
|
||||||
MetadataUpdatePage::MetadataUpdatePage(QWidget *parent)
|
MetadataUpdatePage::MetadataUpdatePage(QWidget *parent)
|
||||||
: QWidget(parent)
|
: ElaScrollPage(parent)
|
||||||
{
|
{
|
||||||
initUI();
|
initUI();
|
||||||
}
|
}
|
||||||
|
|
@ -17,135 +19,169 @@ MetadataUpdatePage::~MetadataUpdatePage()
|
||||||
|
|
||||||
void MetadataUpdatePage::initUI()
|
void MetadataUpdatePage::initUI()
|
||||||
{
|
{
|
||||||
QHBoxLayout *mainLayout = new QHBoxLayout(this);
|
resize(600, 500);
|
||||||
mainLayout->setContentsMargins(50, 50, 50, 50);
|
setTitleVisible(false);
|
||||||
mainLayout->setSpacing(60);
|
this->setContentsMargins(0, 0, 0, 0);
|
||||||
|
this->setWindowTitle("元数据更新");
|
||||||
|
|
||||||
// ==========================================
|
auto* centralWidget = new QWidget(this);
|
||||||
// UFT3更新范围
|
auto* centerLayout = new QVBoxLayout(centralWidget);
|
||||||
// ==========================================
|
|
||||||
QVBoxLayout *uft3SectionLayout = new QVBoxLayout;
|
|
||||||
uft3SectionLayout->setSpacing(15);
|
|
||||||
|
|
||||||
QGroupBox *uft3Group = new QGroupBox("UFT3更新范围");
|
centerLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Policy::Minimum, QSizePolicy::Policy::Expanding));
|
||||||
QGridLayout *uft3Grid = new QGridLayout(uft3Group);
|
|
||||||
uft3Grid->setSpacing(15);
|
|
||||||
uft3Grid->setContentsMargins(15, 15, 15, 15);
|
|
||||||
|
|
||||||
m_uft3StdField = new ElaCheckBox("标准字段");
|
auto* contentWidget = new QWidget(this);
|
||||||
m_uft3StdField->setChecked(true);
|
auto* gridLayout = new QGridLayout(contentWidget);
|
||||||
uft3Grid->addWidget(m_uft3StdField, 0, 0);
|
|
||||||
|
|
||||||
m_uft3DataType = new ElaCheckBox("数据类型");
|
gridLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Minimum), 0, 0, 2, 1);
|
||||||
m_uft3DataType->setChecked(true);
|
|
||||||
uft3Grid->addWidget(m_uft3DataType, 0, 1);
|
|
||||||
|
|
||||||
m_uft3ErrorNo = new ElaCheckBox("标准错误号");
|
auto* uft3GroupBox = new QWidget(contentWidget);
|
||||||
m_uft3ErrorNo->setChecked(true);
|
uft3GroupBox->setObjectName("CardWidget");
|
||||||
uft3Grid->addWidget(m_uft3ErrorNo, 1, 0);
|
uft3GroupBox->setStyleSheet(R"(
|
||||||
|
#CardWidget {
|
||||||
|
background-color: white;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
)");
|
||||||
|
_updateGridLayout = new QGridLayout(uft3GroupBox);
|
||||||
|
_updateGridLayout->setContentsMargins(12, 10, 12, 10);
|
||||||
|
_updateGridLayout->setSpacing(6);
|
||||||
|
|
||||||
m_uft3Interface = new ElaCheckBox("接口数据");
|
auto* uft3Title = new ElaText("UFT30更新范围");
|
||||||
m_uft3Interface->setChecked(true);
|
uft3Title->setStyleSheet("font-size: 14px; font-weight: bold;");
|
||||||
uft3Grid->addWidget(m_uft3Interface, 1, 1);
|
uft3Title->setAlignment(Qt::AlignCenter);
|
||||||
|
_updateGridLayout->addWidget(uft3Title, 0, 0, 1, UPDATE_ITEM_SHOW_COLUMN_COUNT);
|
||||||
|
gridLayout->addWidget(uft3GroupBox, 0, 1, 1, 4);
|
||||||
|
|
||||||
uft3SectionLayout->addWidget(uft3Group);
|
_uft3AllBtn = new ElaPushButton("全选", contentWidget);
|
||||||
|
connect(_uft3AllBtn, &QPushButton::clicked, this, &MetadataUpdatePage::onUFT3SelectAll);
|
||||||
|
gridLayout->addWidget(_uft3AllBtn, 1, 2, 1, 1);
|
||||||
|
|
||||||
QHBoxLayout *uft3BtnLayout = new QHBoxLayout;
|
_uft3CancelBtn = new ElaPushButton("全不选", contentWidget);
|
||||||
uft3BtnLayout->setSpacing(15);
|
connect(_uft3CancelBtn, &QPushButton::clicked, this, &MetadataUpdatePage::onUFT3SelectNone);
|
||||||
ElaPushButton *uft3SelectAllBtn = new ElaPushButton("全选");
|
gridLayout->addWidget(_uft3CancelBtn, 1, 3, 1, 1);
|
||||||
connect(uft3SelectAllBtn, &QPushButton::clicked, this, &MetadataUpdatePage::onUFT3SelectAll);
|
|
||||||
ElaPushButton *uft3SelectNoneBtn = new ElaPushButton("全不选");
|
|
||||||
connect(uft3SelectNoneBtn, &QPushButton::clicked, this, &MetadataUpdatePage::onUFT3SelectNone);
|
|
||||||
ElaPushButton *uft3UpdateBtn = new ElaPushButton("更新UFT3");
|
|
||||||
connect(uft3UpdateBtn, &QPushButton::clicked, this, &MetadataUpdatePage::onUpdateUFT3);
|
|
||||||
|
|
||||||
uft3BtnLayout->addStretch();
|
_uft3UpdateBtn = new ElaPushButton("更新UFT30", contentWidget);
|
||||||
uft3BtnLayout->addWidget(uft3SelectAllBtn);
|
connect(_uft3UpdateBtn, &QPushButton::clicked, this, &MetadataUpdatePage::onUpdateUFT3);
|
||||||
uft3BtnLayout->addWidget(uft3SelectNoneBtn);
|
gridLayout->addWidget(_uft3UpdateBtn, 1, 4, 1, 1);
|
||||||
uft3BtnLayout->addWidget(uft3UpdateBtn);
|
|
||||||
uft3BtnLayout->addStretch();
|
|
||||||
|
|
||||||
uft3SectionLayout->addLayout(uft3BtnLayout);
|
gridLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Minimum), 0, 5, 2, 1);
|
||||||
mainLayout->addLayout(uft3SectionLayout);
|
|
||||||
|
|
||||||
// ==========================================
|
auto* uf20GroupBox = new QWidget(contentWidget);
|
||||||
// UF20更新范围
|
uf20GroupBox->setObjectName("CardWidget");
|
||||||
// ==========================================
|
uf20GroupBox->setStyleSheet(R"(
|
||||||
QVBoxLayout *uf20SectionLayout = new QVBoxLayout;
|
#CardWidget {
|
||||||
uf20SectionLayout->setSpacing(15);
|
background-color: white;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
)");
|
||||||
|
_updateUf2GridLayout = new QGridLayout(uf20GroupBox);
|
||||||
|
_updateUf2GridLayout->setContentsMargins(12, 10, 12, 10);
|
||||||
|
_updateUf2GridLayout->setSpacing(6);
|
||||||
|
|
||||||
QGroupBox *uf20Group = new QGroupBox("UF20更新范围");
|
auto* uf20Title = new ElaText("UF20更新范围");
|
||||||
QGridLayout *uf20Grid = new QGridLayout(uf20Group);
|
uf20Title->setStyleSheet("font-size: 14px; font-weight: bold;");
|
||||||
uf20Grid->setSpacing(15);
|
uf20Title->setAlignment(Qt::AlignCenter);
|
||||||
uf20Grid->setContentsMargins(15, 15, 15, 15);
|
_updateUf2GridLayout->addWidget(uf20Title, 0, 0, 1, UPDATE_ITEM_SHOW_COLUMN_COUNT);
|
||||||
|
gridLayout->addWidget(uf20GroupBox, 0, 6, 1, 4);
|
||||||
|
|
||||||
m_uf20StdField = new ElaCheckBox("标准字段");
|
_uf2AllBtn = new ElaPushButton("全选", contentWidget);
|
||||||
m_uf20StdField->setChecked(true);
|
connect(_uf2AllBtn, &QPushButton::clicked, this, &MetadataUpdatePage::onUF20SelectAll);
|
||||||
uf20Grid->addWidget(m_uf20StdField, 0, 0);
|
gridLayout->addWidget(_uf2AllBtn, 1, 7, 1, 1);
|
||||||
|
|
||||||
m_uf20DataType = new ElaCheckBox("数据类型");
|
_uf2CancelBtn = new ElaPushButton("全不选", contentWidget);
|
||||||
m_uf20DataType->setChecked(true);
|
connect(_uf2CancelBtn, &QPushButton::clicked, this, &MetadataUpdatePage::onUF20SelectNone);
|
||||||
uf20Grid->addWidget(m_uf20DataType, 0, 1);
|
gridLayout->addWidget(_uf2CancelBtn, 1, 8, 1, 1);
|
||||||
|
|
||||||
m_uf20ErrorNo = new ElaCheckBox("标准错误号");
|
_uf2UpdateBtn = new ElaPushButton("更新UF20", contentWidget);
|
||||||
m_uf20ErrorNo->setChecked(true);
|
connect(_uf2UpdateBtn, &QPushButton::clicked, this, &MetadataUpdatePage::onUpdateUF20);
|
||||||
uf20Grid->addWidget(m_uf20ErrorNo, 1, 0);
|
gridLayout->addWidget(_uf2UpdateBtn, 1, 9, 1, 1);
|
||||||
|
|
||||||
m_uf20Table = new ElaCheckBox("表结构");
|
gridLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Minimum), 0, 10, 2, 1);
|
||||||
m_uf20Table->setChecked(true);
|
|
||||||
uf20Grid->addWidget(m_uf20Table, 1, 1);
|
|
||||||
|
|
||||||
m_uf20Interface = new ElaCheckBox("接口数据");
|
centerLayout->addWidget(contentWidget);
|
||||||
m_uf20Interface->setChecked(true);
|
|
||||||
uf20Grid->addWidget(m_uf20Interface, 2, 0);
|
|
||||||
|
|
||||||
uf20SectionLayout->addWidget(uf20Group);
|
centerLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Policy::Minimum, QSizePolicy::Policy::Expanding));
|
||||||
|
|
||||||
QHBoxLayout *uf20BtnLayout = new QHBoxLayout;
|
_processLabel = new ElaText(this);
|
||||||
uf20BtnLayout->setSpacing(15);
|
centerLayout->addWidget(_processLabel);
|
||||||
ElaPushButton *uf20SelectAllBtn = new ElaPushButton("全选");
|
|
||||||
connect(uf20SelectAllBtn, &QPushButton::clicked, this, &MetadataUpdatePage::onUF20SelectAll);
|
|
||||||
ElaPushButton *uf20SelectNoneBtn = new ElaPushButton("全不选");
|
|
||||||
connect(uf20SelectNoneBtn, &QPushButton::clicked, this, &MetadataUpdatePage::onUF20SelectNone);
|
|
||||||
ElaPushButton *uf20UpdateBtn = new ElaPushButton("更新UF20");
|
|
||||||
connect(uf20UpdateBtn, &QPushButton::clicked, this, &MetadataUpdatePage::onUpdateUF20);
|
|
||||||
|
|
||||||
uf20BtnLayout->addStretch();
|
_progressBar = new ElaProgressBar(this);
|
||||||
uf20BtnLayout->addWidget(uf20SelectAllBtn);
|
_progressBar->setValue(0);
|
||||||
uf20BtnLayout->addWidget(uf20SelectNoneBtn);
|
centerLayout->addWidget(_progressBar);
|
||||||
uf20BtnLayout->addWidget(uf20UpdateBtn);
|
|
||||||
uf20BtnLayout->addStretch();
|
|
||||||
|
|
||||||
uf20SectionLayout->addLayout(uf20BtnLayout);
|
centerLayout->setContentsMargins(10, 10, 10, 10);
|
||||||
mainLayout->addLayout(uf20SectionLayout);
|
addCentralWidget(centralWidget, true, false, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MetadataUpdatePage::showEvent(QShowEvent* event)
|
||||||
|
{
|
||||||
|
ElaScrollPage::showEvent(event);
|
||||||
|
static bool firstShow = true;
|
||||||
|
if (firstShow)
|
||||||
|
{
|
||||||
|
firstShow = false;
|
||||||
|
showUpdateItems();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MetadataUpdatePage::showUpdateItems()
|
||||||
|
{
|
||||||
|
QStringList uft3Items = {"标准字段", "数据类型", "标准错误号",
|
||||||
|
"接口数据"};
|
||||||
|
|
||||||
|
QStringList uf20Items = {"标准字段", "数据类型", "标准错误号",
|
||||||
|
"接口数据"};
|
||||||
|
|
||||||
|
for (int i = 0; i < uft3Items.size(); ++i) {
|
||||||
|
auto* cbx = new ElaCheckBox(uft3Items[i]);
|
||||||
|
cbx->setCheckState(Qt::Checked);
|
||||||
|
uft3CheckBoxes.append(cbx);
|
||||||
|
_updateGridLayout->addWidget(cbx, i / UPDATE_ITEM_SHOW_COLUMN_COUNT + 1, i % UPDATE_ITEM_SHOW_COLUMN_COUNT);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < uf20Items.size(); ++i) {
|
||||||
|
auto* cbx = new ElaCheckBox(uf20Items[i]);
|
||||||
|
cbx->setCheckState(Qt::Checked);
|
||||||
|
uf20CheckBoxes.append(cbx);
|
||||||
|
_updateUf2GridLayout->addWidget(cbx, i / UPDATE_ITEM_SHOW_COLUMN_COUNT + 1, i % UPDATE_ITEM_SHOW_COLUMN_COUNT);
|
||||||
|
}
|
||||||
|
|
||||||
|
int uft3Count = uft3Items.size();
|
||||||
|
int uf20Count = uf20Items.size();
|
||||||
|
while (uft3Count < uf20Count) {
|
||||||
|
_updateGridLayout->addWidget(new QWidget(this), uft3Count / UPDATE_ITEM_SHOW_COLUMN_COUNT + 1, uft3Count % UPDATE_ITEM_SHOW_COLUMN_COUNT);
|
||||||
|
++uft3Count;
|
||||||
|
}
|
||||||
|
while (uf20Count < uft3Count) {
|
||||||
|
_updateUf2GridLayout->addWidget(new QWidget(this), uf20Count / UPDATE_ITEM_SHOW_COLUMN_COUNT + 1, uf20Count % UPDATE_ITEM_SHOW_COLUMN_COUNT);
|
||||||
|
++uf20Count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetadataUpdatePage::onUF20SelectAll()
|
void MetadataUpdatePage::onUF20SelectAll()
|
||||||
{
|
{
|
||||||
m_uf20StdField->setChecked(true);
|
for (auto* cbx : uf20CheckBoxes) {
|
||||||
m_uf20DataType->setChecked(true);
|
cbx->setChecked(true);
|
||||||
m_uf20ErrorNo->setChecked(true);
|
}
|
||||||
m_uf20Table->setChecked(true);
|
|
||||||
m_uf20Interface->setChecked(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetadataUpdatePage::onUF20SelectNone()
|
void MetadataUpdatePage::onUF20SelectNone()
|
||||||
{
|
{
|
||||||
m_uf20StdField->setChecked(false);
|
for (auto* cbx : uf20CheckBoxes) {
|
||||||
m_uf20DataType->setChecked(false);
|
cbx->setChecked(false);
|
||||||
m_uf20ErrorNo->setChecked(false);
|
}
|
||||||
m_uf20Table->setChecked(false);
|
|
||||||
m_uf20Interface->setChecked(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetadataUpdatePage::onUpdateUF20()
|
void MetadataUpdatePage::onUpdateUF20()
|
||||||
{
|
{
|
||||||
QStringList selectedItems;
|
QStringList selectedItems;
|
||||||
if (m_uf20StdField->isChecked()) selectedItems << "标准字段";
|
for (auto* cbx : uf20CheckBoxes) {
|
||||||
if (m_uf20DataType->isChecked()) selectedItems << "数据类型";
|
if (cbx->isChecked()) {
|
||||||
if (m_uf20ErrorNo->isChecked()) selectedItems << "标准错误号";
|
selectedItems << cbx->text();
|
||||||
if (m_uf20Table->isChecked()) selectedItems << "表结构";
|
}
|
||||||
if (m_uf20Interface->isChecked()) selectedItems << "接口数据";
|
}
|
||||||
|
|
||||||
if (selectedItems.isEmpty()) {
|
if (selectedItems.isEmpty()) {
|
||||||
QMessageBox::warning(this, "提示", "请选择至少一项更新内容");
|
QMessageBox::warning(this, "提示", "请选择至少一项更新内容");
|
||||||
|
|
@ -157,32 +193,31 @@ void MetadataUpdatePage::onUpdateUF20()
|
||||||
|
|
||||||
void MetadataUpdatePage::onUFT3SelectAll()
|
void MetadataUpdatePage::onUFT3SelectAll()
|
||||||
{
|
{
|
||||||
m_uft3StdField->setChecked(true);
|
for (auto* cbx : uft3CheckBoxes) {
|
||||||
m_uft3DataType->setChecked(true);
|
cbx->setChecked(true);
|
||||||
m_uft3ErrorNo->setChecked(true);
|
}
|
||||||
m_uft3Interface->setChecked(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetadataUpdatePage::onUFT3SelectNone()
|
void MetadataUpdatePage::onUFT3SelectNone()
|
||||||
{
|
{
|
||||||
m_uft3StdField->setChecked(false);
|
for (auto* cbx : uft3CheckBoxes) {
|
||||||
m_uft3DataType->setChecked(false);
|
cbx->setChecked(false);
|
||||||
m_uft3ErrorNo->setChecked(false);
|
}
|
||||||
m_uft3Interface->setChecked(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetadataUpdatePage::onUpdateUFT3()
|
void MetadataUpdatePage::onUpdateUFT3()
|
||||||
{
|
{
|
||||||
QStringList selectedItems;
|
QStringList selectedItems;
|
||||||
if (m_uft3StdField->isChecked()) selectedItems << "标准字段";
|
for (auto* cbx : uft3CheckBoxes) {
|
||||||
if (m_uft3DataType->isChecked()) selectedItems << "数据类型";
|
if (cbx->isChecked()) {
|
||||||
if (m_uft3ErrorNo->isChecked()) selectedItems << "标准错误号";
|
selectedItems << cbx->text();
|
||||||
if (m_uft3Interface->isChecked()) selectedItems << "接口数据";
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (selectedItems.isEmpty()) {
|
if (selectedItems.isEmpty()) {
|
||||||
QMessageBox::warning(this, "提示", "请选择至少一项更新内容");
|
QMessageBox::warning(this, "提示", "请选择至少一项更新内容");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMessageBox::information(this, "提示", QString("UFT3更新功能开发中,已选择: %1").arg(selectedItems.join(", ")));
|
QMessageBox::information(this, "提示", QString("UFT30更新功能开发中,已选择: %1").arg(selectedItems.join(", ")));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
#ifndef METADATUPDATEPAGE_H
|
#ifndef METADATUPDATEPAGE_H
|
||||||
#define METADATUPDATEPAGE_H
|
#define METADATUPDATEPAGE_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include "ElaScrollPage.h"
|
||||||
#include "ElaCheckBox.h"
|
|
||||||
#include "ElaPushButton.h"
|
#include "ElaPushButton.h"
|
||||||
#include <QGroupBox>
|
#include "ElaText.h"
|
||||||
|
#include "ElaProgressBar.h"
|
||||||
|
#include "ElaCheckBox.h"
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
class MetadataUpdatePage : public QWidget
|
class MetadataUpdatePage : public ElaScrollPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
@ -14,6 +17,9 @@ public:
|
||||||
explicit MetadataUpdatePage(QWidget *parent = nullptr);
|
explicit MetadataUpdatePage(QWidget *parent = nullptr);
|
||||||
~MetadataUpdatePage();
|
~MetadataUpdatePage();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void showEvent(QShowEvent* event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onUF20SelectAll();
|
void onUF20SelectAll();
|
||||||
void onUF20SelectNone();
|
void onUF20SelectNone();
|
||||||
|
|
@ -24,17 +30,21 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initUI();
|
void initUI();
|
||||||
|
void showUpdateItems();
|
||||||
|
|
||||||
ElaCheckBox *m_uf20StdField;
|
QGridLayout* _updateGridLayout{nullptr};
|
||||||
ElaCheckBox *m_uf20DataType;
|
QGridLayout* _updateUf2GridLayout{nullptr};
|
||||||
ElaCheckBox *m_uf20ErrorNo;
|
ElaPushButton* _uf2UpdateBtn{nullptr};
|
||||||
ElaCheckBox *m_uf20Table;
|
ElaPushButton* _uf2CancelBtn{nullptr};
|
||||||
ElaCheckBox *m_uf20Interface;
|
ElaPushButton* _uft3AllBtn{nullptr};
|
||||||
|
ElaPushButton* _uft3CancelBtn{nullptr};
|
||||||
|
ElaPushButton* _uf2AllBtn{nullptr};
|
||||||
|
ElaPushButton* _uft3UpdateBtn{nullptr};
|
||||||
|
ElaText* _processLabel{nullptr};
|
||||||
|
ElaProgressBar* _progressBar{nullptr};
|
||||||
|
|
||||||
ElaCheckBox *m_uft3StdField;
|
QList<ElaCheckBox*> uft3CheckBoxes;
|
||||||
ElaCheckBox *m_uft3DataType;
|
QList<ElaCheckBox*> uf20CheckBoxes;
|
||||||
ElaCheckBox *m_uft3ErrorNo;
|
|
||||||
ElaCheckBox *m_uft3Interface;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Loading…
Reference in New Issue